This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery.fn.extend({ | |
| live: function(types, data, fn) { | |
| jQuery(this.context).on(types, this.selector, data, fn); | |
| return this; | |
| }, | |
| die: function(types, fn) { | |
| jQuery(this.context).off(types, this.selector || "**", fn); | |
| return this; | |
| }, | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function populateGet() { | |
| var obj = {}, params = location.search.slice(1).split('&'); | |
| for (var i = 0, len = params.length; i < len; i++) { | |
| var keyVal = params[i].split('='); | |
| obj[decodeURIComponent(keyVal[0])] = decodeURIComponent(keyVal[1]); | |
| } | |
| return obj; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).ready(function(){ | |
| $('div').bind('scroll',chk_scroll); | |
| }); | |
| function chk_scroll(e) | |
| { | |
| var elem = $(e.currentTarget); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var url = $(location).attr('href'); //get current url | |
| //OR | |
| var url = 'folder%2Findex.html%3Fparam%3D%2323dd%26noob%3Dyes'; //or specify one | |
| var decodedUrl = decodeURIComponent(url); | |
| console.log(decodedUrl); | |
| //outputs folder/index.html?param=#23dd&noob=yes | |
| ---------------------------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery.fn.center = function() { | |
| return this.each(function() { | |
| var t = $(this); | |
| t.css({ | |
| 'position': 'absolute', | |
| 'top': (t.parent().height() - t.height()) / 2 + t.parent().scrollTop() + "px", | |
| 'left': (t.parent().width() - t.width()) / 2 + t.parent().scrollLeft() + "px" | |
| }).parent().css('position', 'relative'); | |
| }); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //iPAD Support | |
| $.fn.addTouch = function(){ | |
| this.each(function(i,el){ | |
| $(el).bind('touchstart touchmove touchend touchcancel',function(){ | |
| //we pass the original event object because the jQuery event | |
| //object is normalized to w3c specs and does not provide the TouchList | |
| handleTouch(event); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MY_OBJECT = | |
| { | |
| cache: {}, | |
| init: function() | |
| { | |
| this.cache.c = $('#container'); | |
| this.cache.n = this.cache.c.find('.nested'); | |
| this.cache.s = this.cache.c.find('#status'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('#theImage').attr('src', 'image.jpg').load(function() { | |
| alert('This Image Has Been Loaded'); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function($) { | |
| $.fn.stripHtml = function() { | |
| var regexp = /<("[^"]*"|'[^']*'|[^'">])*>/gi; | |
| this.each(function() { | |
| $(this).html( | |
| $(this).html().replace(regexp,"") | |
| ); | |
| }); | |
| return $(this); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if(jQuery.browser.mobile) | |
| { | |
| console.log('You are using a mobile device!'); | |
| } | |
| else | |
| { | |
| console.log('You are not using a mobile device!'); | |
| } | |
| var isiPad = /ipad/i.test(navigator.userAgent.toLowerCase()); |