The drop works very well but when i specify width to the div where I drop the drop is disabled.
I want to know if there is a way to specify width without disabling drop?
<div style="width:100%;">
<div>
<div class="inline" class="inline"> {{qpart1}} </div>
<div class="inline" style='width:50px'>
<div style='height:25px;background-color: #007fff' data-drop={{candrop}} multiple='fasle' data-jqyoui-options ng-model="list2" jqyoui-droppable >
<div class="btn btn-success" style='width:50px' data-drag="false" data-jqyoui-options ng-model="list2" jqyoui-draggable ng-hide="!list2.title">{{list2.title}}</div>
</div>
</div>
<div class="inline"> {{qpart2}}</div><br><br><br>
</div>
<div ng-repeat="rep in rps">
<decorate-dargs></decorate-dargs>
</div>
</div>
Related
I have a form with some hidden input fields. Additional I have a link, which has a reset function, by clicking on it, it sets the hidden fields a "0" as value and submits the form.
It works fine, except by output the POST array, I still see the old values. How can I change that ?
Here is the HTML form:
<form method="POST" action="http://localhost" accept-charset="UTF-8" id="filter_form">
<input name="_token" type="hidden" value="mWIbgqI6sXZTyZpaW3Z3x1QqxZpwnl0BdmJtDmRY">
<input type="hidden" id="select_finance" name="select_finance" value="0">
<input type="hidden" id="filter_finance" name="filter_finance" value="60">
<div class="row " style="margin-top: 5px; display: none;" id="finance_filters">
<div class="col-md-12">
<div class="owl-carousel col-md-12">
<div class="item">
<div class="top_sub_link">
COPPER
</div>
</div>
<div class="item">
<div class="top_sub_link">
WHEAT
</div>
</div>
<div class="item">
<div class="top_sub_link">
SILVER
</div>
</div>
<div class="item">
<div class="top_sub_link">
GOLD
</div>
</div>
<div class="item">
<div class="top_sub_link activemediasublink">
GAS <i class="close_filter"></i>
</div>
</div>
</div>
<div class="owl-nav"></div>
</div>
</div>
</form>
Here is the Javascript code:
$(document).ready(function() {
$(".close_filter").on('click', function() {
$('#filter_finance').val('0');
$('#select_finance').val('0');
$("#filter_form").submit();
});
});
The element on which you're attaching the onClick event is not the whole link but a tag inside the link. Thus, the clickable area is too small -maybe not even visible.
In your JavaScript, replace this:
$(".close_filter").on('click', function() {
With this:
$(".close_ink").on('click', function() {
I am new in javascript,i have a page consist of different Card layouts and each card has its own chart or buttons or grids,some of them should be hidden by default and some of them should be hide or visible by click,since the page is growing by more demands ,controlling these hid/e/show is becoming a nightmare,i would like you tell me whats the best way to do this?for example i have a following div which has a chart:
<section style="width:100%;margin-top:2%;" >
<div id="btnCurrentStatID" class="card ShowHide" style="float:right;width:20%;height:350px;display:none;">
<div class="wrapper">
<div class="containerBtns" style="width:100%;float:right" >
<button type="button" id="btnErrorStat" class="btnsForCrew-Common "></button>
<button type="button" id="btnIdle" class="btnsForCrew-Common "></button>
<button type="button" id="btnService" class="btnsForCrew-Common "></button>
<button type="button" id="btnLinkDn" class="btnsForCrew-Common"></button>
<button type="button" id="btnDataIn" class="btnsForCrew-Common" ></button>
<button type="button" id="btnrepOff" class="btnsForCrew-Common"></button>
</div>
</div>
</div>
<div id="faultStatChartID" class="card ShowHide" >
<div id="chart">
</div>
</div>
<div id="pieChartID" class="card ShowHide">
<div id="pieChart"></div>
</div>
</section>
<section style="width:100%;float:left;margin-top:3%;" id="faultStatSubGroupsSec">
<div id="subcatNameChartSectionID" class="card" style="width:49%;float:left;display:none">
<div class="container">
<div id="subcatNameChart"></div>
</div>
</div>
<div id="subcatErrorChartSectionID" class="card" style="width:49%;float:right;display:none">
<div class="container">
<div id="subcatErrorChart"></div>
</div>
</div>
<div id="subCatIdnameSectionID" class="card" style="width:49%;float:left;display:none">
<div class="container">
<div id="subCatIdname"></div>
</div>
</div>
<div id="subCatITurNameSectionID" class="card"style="width:49%;float:right;display:none">
<div class="container">
<div id="subCatITurName"></div>
</div>
</div>
<div></div>
<div></div>
</section>
i gave it showhide class,and by default its hidden,when i click on filter button it will be visible,and other divs should be hidden,it this continues,imagine how many time i should do it and manage to control them all,
$(".ShowHide").css("display", "block");
$("#subcatNameChartSectionID").hide();
$("#subcatErrorChartSectionID").hide();
$("#subCatIdnameSectionID").hide();
$("#subCatITurNameSectionID").hide();
A way would be to use a class for hiding.
.hide {
display: none;
}
And a hideable class for accessing every item that should be able to be hidden. The class hide can be added to hide the element.
<div class="hideable">1 hideable</div>
jQuery offers methods for class manipulation:
$('.hideable').toggleClass('hide');
$('#unique4').removeClass('hide');
$('#unique5').addClass('hide');
Here is the full snippet code:
$('.hideable').toggleClass('hide');
$('#unique4').removeClass('hide');
$('#unique5').addClass('hide');
.hide {
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="unique1" class="hideable">
1 hideable
</div>
<div id="unique2" class="hideable">
2 hideable
</div>
<div id="unique3" class="hideable hide">
3 hideable
</div>
<div id="unique4" class="hideable hide">
4 hideable
</div>
<div id="unique5" class="hide">
5 other
</div>
I am using absolutely positioned containers to slide screens left and right on "Next" and "Back". You can see this here: http://opencdesign.herokuapp.com/offer
Click "Got it" to move to 2nd screen, which is where the problem lies. If you click "Add item or category" enough times, the inputs will expand past the footer.
What is the simplest way to expand the height of the window as I add inputs? I'm also open to an alternative method of sliding screens left and right than using absolute positioning.
HTML
<div id="offer-2">
<div class="row one-margin-bottom">
<div class="small-12 medium-11 small-centered columns">
<h5 class="">What share of purchases will you accept in Currents?</h5>
<!-- <a class="offer-info-popup_open"><i class="half-margin-right fa fa-lg fa-question-circle"></i>How it works</a> -->
</div>
</div>
<div class="row left">
<div class="small-12 medium-6 small-centered columns">
<div class="row">
<div class="input-left small-3 columns">
<p><strong><img class="" src="{% static 'img/symbol-navy.svg' %}"/> share</strong></p>
</div>
<div class="input-right small-9 columns">
<p id="item-title"><strong>Item or category</strong></p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="small-12 medium-6 small-centered columns">
<div id="item-1" class="row collapse">
<div class="input-left small-3 columns">
<div class="relative">
<input name="discount-amount-1" type="number" class="fit-left qtr-margin-right" placeholder="20" value="20"/>
<span class="input-icon-right">%</span>
</div>
<!-- <span class="input-sizer"><select name="discount-type-1">
<option selected>% of</option>
<option>$ of</option>
</select></span> -->
</div>
<div class="input-right small-9 columns">
<div class="fit-left half-margin-top one-margin-right one-margin-left">of</div>
<div class="relative input-sizer">
<input name="item-name-1" type="text" placeholder="Item or category name" value="All products" class="good-cat" />
<i class="remove-input alert fa fa-times"></i>
</div>
</div>
</div>
<div id="item-2" class="row collapse">
<div class="input-left small-3 columns">
<div class="relative">
<input name="discount-amount-2" type="number" class="fit-left qtr-margin-right" placeholder="20" value="20"/>
<span class="input-icon-right">%</span>
</div>
<!-- <span class="input-sizer"><select name="discount-type-1">
<option selected>% of</option>
<option>$ of</option>
</select></span> -->
</div>
<div class="input-right small-9 columns">
<div class="fit-left half-margin-top one-margin-right one-margin-left">of</div>
<div class="relative input-sizer">
<input name="item-name-2" type="text" placeholder="Item or category name" value="All services" class="good-cat" />
<i class="remove-input alert fa fa-times"></i>
</div>
</div>
</div>
<a id="add-item" class=""><i class="half-margin-top fa fa-plus-circle half-margin-right"></i>Add item or category</a>
<div class="row one-margin-top">
<a class="prev-offer button round secondary">Back</a>
<a class="next-offer button round">Next</a>
</div>
</div>
</div>
</div>
JS
var id = 3
$('#add-item').click(function(){
$(this).before('<div id="item-'+id+'" class="row collapse hidden"><div class="input-left small-3 columns"><div class="relative"><input name="discount-amount-'+id+'" type="number" class="fit-left qtr-margin-right" placeholder="20" value="20"/><span class="input-icon-right">%</span></div></div><div class="input-right small-9 columns"><div class="fit-left half-margin-top one-margin-right one-margin-left">of</div><div class="relative input-sizer"><input name="item-name-'+id+'" type="text" placeholder="Item or category name" /><i class="remove-input alert fa fa-times"></i></div></div></div>');
$('#item-'+id+'').slideDown();
id ++
});
I think you could potentially target the div with a CSS rule and handle its overflow-y with scroll (or increase its size, if you want to expand it). For a quick example, using jQuery, you could have a condition followed by $('#mydiv').css("overflow-y", "scroll"); (though it doesn't look like that div currently has an ID or custom Classname, so feel free to change that to whatever works best).
Alternatively, you could use a second, hidden div which is a parent to this one, and expand the hidden div. By using a relative size, you'd be able to fill into the invisible parent =)
It looks good, though!
So I have the following code:
https://jsfiddle.net/8rhscamn/
<div class="well">
<div class="row text-center">
<div class="col-sm-1"> </div>
<div class="col-sm-5 col-xs-12">
<button type="button" class="btn btn-success" id="butt1" onclick="alert('Hola')">Button <br />One</button>
</div>
<div class="col-sm-5 col-xs-12">
<button type="button" class="btn btn-default" id="butt2" onclick="alert('Hello')">Button <br />Two</button>
</div>
<div class="col-sm-1"> </div>
</div>
</div>
It is a simple bootstrap well with columns inside that contains buttons that should execute a simple alert command. Problem is, when resized to the xs size column (like in the fiddle I am including), the buttons don't work. The buttons don't even are recognized as such (this is, the mouse indicator does not switch to the hand indicator when the pointer is over the button).
Any clue what I am doing wrong? Any help will be appreciated, thanks!
Your last div
<div class="col-sm-1"> </div>
Do you need it? If you delete this div you can click on button, because this div cover your button so you can't click on it.
Simply remove the col-xs-12 classes. By default, the col-sm-* classes become full-width on small screen widths anyway. The floats in col-xs-* were causing the issue.
JSFiddle
If you were using the col-sm-1 elements as horizontal padding, I suggest you use the col-sm-offset-* classes, eg
<div class="row">
<div class="col-sm-5 col-sm-offset-1">
<button>...</button>
</div>
<div class="col-sm-5">
<button>...</button>
</div>
</div>
JSFiddle
<!-- Their are 2 ways. either make a function or can go through the second way -->
function f(thetext)
{
alert(thetext);
}
<button type="button" class="btn btn-success" id="butt1" onclick="f('text1')">Button <br />One</button>
<button type="button" class="btn btn-default" id="butt2" onclick="f('text2')">Button <br />Two</button>
<!--Or you can go the following way by deleting the following line in your code.-->
<div class="col-sm-1"> </div>
Hi I am trying to implement tabbed content using bootstraps btn-group. I have some working code, but am not sure it is the best way to go about it.
HTML:
<section class="section" id="tabContent">
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<div class="btn-group btn-group-sm btn-group-justified" data-toggle="buttons">
<div class="btn btn-inverse active tabber" id="submission-div">
<label for="submission">Submission</label>
<input type="radio" checked="" id="submission">
</div>
<div class="btn btn-inverse tabber" id="rules-div">
<label for="rules">Rules</label>
<input type="radio" checked="" id="rules">
</div>
</div>
</div>
</div>
<div id="submission-content">
<h1>Submission content</h1>
</div>
<div id="rules-content" class="hide">
<h1>Rules</h1>
</div>
</div>
</section>
CSS:
.hide {
display: none;
}
JQuery:
$(document).on('click','.tabber',function(e){
if ($("#submission-div").hasClass("active")) {
$("#submission-content").addClass("hide");
$("#rules-content").removeClass("hide");
}else if ($("#rules-div").hasClass("active")){
$("#rules-content").addClass("hide");
$("#submission-content").removeClass("hide");
}
});
This JQuery onClick callback works, doesn't make sense when you read it. I think this is because this FXN is fired off before the active class has been updated in the markup.
I was hoping for a better way to accomplish tab content, hopefully with out changing the markup too much cause the styling is correct for the markup.
Any suggestions would be appreciated.
Thanks!
A
Why don't you use the Bootstrap Tabs with data-toggle="tab" and data-target= attributes? (no jQuery needed)..
Demo: http://www.bootply.com/ZueoFI9iFC
<section class="section" id="tabContent">
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<div class="btn-group btn-group-sm btn-group-justified"
data-toggle="buttons">
<div class="btn btn-inverse active tabber" id="submission-div"
data-toggle="tab" data-target="#submission-content">
<label for="submission">Submission</label>
<input type="radio" checked="" id="submission"/>
</div>
<div class="btn btn-inverse tabber" id="rules-div"
data-toggle="tab" data-target="#rules-content">
<label for="rules">Rules</label>
<input type="radio" checked="" id="rules"/>
</div>
</div>
</div>
</div>
<div class="tab-content">
<div id="submission-content" class="tab-pane active">
<h1>Submission content</h1>
</div>
<div id="rules-content" class="tab-pane">
<h1>Rules</h1>
</div>
</div>
</div>
</section>
I feel like there's likely a cleaner overall solution, but if you're wanting to just have your JQ make sense and change as little as possible, you can do this:
$(".tabber").click(function(){
if ($(this).is("#submission-div")) {
$("#submission-content").removeClass("hide");
$("#rules-content").addClass("hide");
}else if ($(this).is("#rules-div")){
$("#rules-content").removeClass("hide");
$("#submission-content").addClass("hide");
}
});