Skip to content

Instantly share code, notes, and snippets.

@kswedberg
kswedberg / jquery.loadasync.js
Created January 26, 2012 19:03 — forked from mathiasbynens/jquery.loadasync.js
Use jQuery to load scripts asynchronously
// Load scripts asynchronously
jQuery.loadScript = function(url, options) {
// Don't use $.getScript since it disables caching
options = $.extend(options || {}, {
dataType: 'script',
cache: true,
url: url
};
jQuery.ajax(options);
@kswedberg
kswedberg / README.md
Created May 25, 2011 14:47 — forked from mathiasbynens/README.md
Improved swipe gestures plugin for jQuery

Improved swipe gestures plugin for jQuery

What Mathias changed (compared to the original v0.1.2):

  • Don’t modify the default settings internally.
  • Merge the options recursively (deep copy) so that the custom threshold values actually get used.
  • Allow overriding the options globally through $.fn.swipe.options.
  • Use namespaced jQuery events (using the swipe namespace) instead of DOM2 addEventListener to prevent errors in old IEs.
  • Simplified and optimized code.
<script>
$(window).load(function() {
$(".carousel").jCarouselLite({
btnNext: function() {
return $(this).find(".next-gallery");
},
btnPrev: function() {
return $(this).find(".previous-gallery");
},
visible: 1
var elem = document.createElement("div"),
style = elem.style,
userSelectProp = "userSelect" in style && "userSelect";
if (!userSelectProp) {
$.each("Moz Webkit Khtml O".split(" "), function(i, v) {
var vendorProp = v + "UserSelect";
if ( vendorProp in style ) {
userSelectProp = vendorProp;
return false;
function getElementsInRegion(x, y, width, height) {
var elements = [],
expando = +new Date,
cx = x,
cy = y,
curEl;
height = y + height;
width = x + width;
// easy refresh-css keybinding to alt-w
// alt-r was taken in IE, so consider this a CSS Weefresh
// original code from http://paulirish.com/2008/how-to-iterate-quickly-when-debugging-css/
$(document).keyup(function(e){
if ( e.which == 87 && e.altKey){
var h=0,a=document.getElementsByTagName('link'),l=a.length,f;
for(;h<l;h++){