JQuery

Created Thursday 28 November 2013

  1. jQuery site:
    1. http://jquery.com/
  2. jQuery UI site:
    1. http://jqueryui.com/
  3. Performance boost advices:
    1. http://24ways.org/2011/your-jquery-now-with-less-suck/

  1. Scrollbars:
    1. http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/quick-tip-styling-scrollbars-to-match-your-ui-design/
    2. http://www.yuiazu.net/perfect-scrollbar/
    3. http://jscrollpane.kelvinluck.com/
    4. Right-to-Left:
      1. http://stackoverflow.com/questions/12990030/jquery-jscrollpane-horizontal-scroll-direction-scroll-right
var pane = $('.scroll-pane');
pane.jScrollPane(
{
// Any settings you need
}
);
var api = pane.data('jsp');
api.scrollToX(9999, false);

  1. Select item from <select>:
    1. $("#MySelectBox").val("5");
    2. http://stackoverflow.com/questions/7399640/jquery-select-option-in-select-box
    3. http://stackoverflow.com/questions/496052/jquery-setting-the-selected-value-of-a-select-control-via-its-text-description
  2. $.cookie is not a function:
    1. http://stackoverflow.com/questions/18024539/jquery-cookie-is-not-a-function
  3. Increment css top property:
    1. http://stackoverflow.com/questions/4359184/increment-css-top-property-using-jquery
var e = $("#id");
e.css('top', (parseFloat(e.css('top')) + 10) + 'px');

  1. Run function only after another one is finished:
    1. http://stackoverflow.com/questions/12116505/wait-till-a-function-is-finished-until-running-another-function
var funcOne = function () {
var r = $.Deferred();
// do things...
setTimeout(function() {
r.resolve();
}, 2500);
return r;
};
var funcTwo = function() {
// do other things
};
funcOne().done(funcTwo);

  1. Check if checkbox is checked:
    1. var isChecked = $('#checkbox').is(':checked');
    2. http://www.jquerybyexample.net/2012/03/check-if-checkbox-is-checked-using.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+JqueryByExample+%28jQuery+By+Example%29
  2. Refresh selector:
    1. someVar = $(someVar.selector);
  3. Setting dates with datepicker()
$(document).ready(function() {
var currentDate = new Date();
var firstDay = new Date();
firstDay.setMonth(firstDay.getMonth(), 1);
alert(firstDay);
$.datepicker.setDefaults({
showOn: "both",
buttonText: "לוח שנה"
});
$("#startDate").datepicker({dateFormat: 'dd-mm-yy'});
$("#endDate").datepicker({dateFormat: 'dd-mm-yy'});
$("#startDate").datepicker("setDate", firstDay);
$("#endDate").datepicker("setDate", currentDate);
});
  1. Restricting one datepicker by another:
$(document).ready(function(){
$("#txtFromDate").datepicker({
numberOfMonths: 2,
onSelect: function(selected) {
$("#txtToDate").datepicker("option","minDate", selected)
}
});
$("#txtToDate").datepicker({
numberOfMonths: 2,
onSelect: function(selected) {
$("#txtFromDate").datepicker("option","maxDate", selected)
}
});
});
    1. http://stackoverflow.com/questions/17169772/how-to-compare-two-datepicker-date-jquery
  1. Plugin to find element position in a visible area
    1. https://github.com/xobotyi/jquery.viewport
  2. Get updated location (src) from iframe
    1. http://stackoverflow.com/questions/3705594/access-iframe-url-with-jquery-javascript
    2. $("#mainFrame").get(0).contentWindow.location



Backlinks: