├── images ├── bee.gif ├── car1.jpg ├── car2.jpg ├── car3.jpg ├── car4.jpg ├── car5.jpg ├── 404-duh.png ├── favicon.ico ├── loading.gif ├── cats-eyes.jpg ├── grid-18px.png ├── sam-deering.jpg ├── jquery-books.jpg ├── smashing-cat.png ├── smashing-logo.jpg ├── twitter-eyes-open.jpg ├── jquery4u-logo-small.jpg └── twitter-eyes-closed.jpg ├── functions ├── css │ ├── css-demo.zip │ ├── css-desc.php │ ├── css │ │ └── demostyles.css │ └── css-demo.html ├── ajax │ ├── ajax-demo.zip │ ├── images │ │ ├── car1.jpg │ │ ├── car2.jpg │ │ ├── car3.jpg │ │ └── loading.gif │ ├── data │ │ ├── content2.html │ │ ├── content1.html │ │ └── content3.html │ ├── ajax-desc.php │ └── ajax-demo.html ├── bind │ ├── bind-demo.zip │ ├── bind-desc.php │ └── bind-demo.html ├── data │ ├── data-demo.zip │ ├── data-desc.php │ └── data-demo.html ├── each │ ├── each-demo.zip │ └── each-desc.php ├── find │ ├── find-demo.zip │ ├── find-desc.php │ └── find-demo.html ├── html │ ├── html-demo.zip │ ├── html-desc.php │ └── html-demo.html ├── live │ ├── live-demo.zip │ ├── images │ │ └── cats-eyes.jpg │ ├── live-desc.php │ └── live-demo.html ├── load │ ├── load-demo.zip │ ├── load-desc.php │ └── load-demo.html ├── next │ ├── next-demo.zip │ ├── next-desc.php │ └── next-demo.html ├── append │ ├── append-demo.zip │ ├── append-desc.php │ └── append-demo.html ├── clone │ ├── clone-demo.zip │ ├── images │ │ └── bee.gif │ ├── clone-desc.php │ └── clone-demo.html ├── delay │ ├── delay-demo.zip │ ├── delay-desc.php │ └── delay-demo.html ├── extend │ ├── extend-demo.zip │ └── extend-desc.php ├── filter │ ├── filter-demo.zip │ ├── filter-desc.php │ └── filter-demo.html ├── jsonp │ ├── jsonp-demo.zip │ ├── images │ │ └── loading.gif │ ├── jsonp-desc.php │ └── jsonp-demo.html ├── match │ ├── match-demo.zip │ ├── match-desc.php │ └── match-demo.html ├── slice │ ├── slice-demo.zip │ ├── slice-desc.php │ └── slice-demo.html ├── animate │ ├── animate-demo.zip │ ├── images │ │ ├── car1.jpg │ │ ├── car2.jpg │ │ ├── car3.jpg │ │ ├── car4.jpg │ │ ├── car5.jpg │ │ └── jquery-books.jpg │ ├── animate-desc.php │ └── animate-demo.html ├── getjson │ ├── getjson-demo.zip │ ├── data │ │ └── colors.json │ ├── getjson-desc.php │ └── getjson-demo.html ├── addclass │ ├── addclass-demo.zip │ ├── addclass-desc.php │ └── addclass-demo.html ├── delegate │ ├── delegate-demo.zip │ ├── delegate-desc.php │ └── delegate-demo.html ├── getscript │ ├── getscript-demo.zip │ ├── images │ │ └── loading.gif │ ├── getscript-desc.php │ └── getscript-demo.html ├── fadetoggle │ ├── fadetoggle-demo.zip │ ├── fadetoggle-desc.php │ └── fadetoggle-demo.html ├── setinterval │ ├── setinterval-demo.zip │ ├── setinterval-desc.php │ └── setinterval-demo.html ├── settimeout │ ├── settimeout-demo.zip │ ├── settimeout-desc.php │ └── settimeout-demo.html ├── slidetoggle │ ├── slidetoggle-demo.zip │ ├── slidetoggle-desc.php │ └── slidetoggle-demo.html ├── toggleclass │ ├── toggleclass-demo.zip │ ├── images │ │ ├── twitter-eyes-closed.jpg │ │ └── twitter-eyes-open.jpg │ ├── toggleclass-desc.php │ └── toggleclass-demo.html ├── preventdefault │ ├── preventdefault-demo.zip │ ├── preventdefault-desc.php │ └── preventdefault-demo.html ├── serializearray │ ├── serializearray-demo.zip │ ├── serializearray-desc.php │ └── serializearray-demo.html ├── stoppropagation │ ├── stoppropagation-demo.zip │ ├── stoppropagation-desc.php │ └── stoppropagation-demo.html └── stopimmediatepropagation │ ├── stopimmediatepropagation-demo.zip │ ├── stopimmediatepropagation-desc.php │ └── stopimmediatepropagation-demo.html ├── data ├── colors.json ├── content2.html ├── data.json ├── content1.html └── content3.html ├── css ├── demostyles.css ├── style.css ├── github.css └── shThemeEclipse.css ├── js ├── syntaxhighlighter │ ├── shBrushPlain.js │ ├── shBrushDiff.js │ ├── shAutoloader.js │ ├── shBrushJScript.js │ ├── shLegacy.js │ ├── shBrushErlang.js │ ├── shBrushScala.js │ ├── shBrushXml.js │ ├── shBrushJava.js │ ├── shBrushRuby.js │ ├── shBrushJavaFX.js │ ├── shBrushVb.js │ ├── shBrushDelphi.js │ ├── shBrushAS3.js │ ├── shBrushPython.js │ ├── shBrushCSharp.js │ ├── shBrushBash.js │ ├── shBrushGroovy.js │ ├── shBrushSql.js │ ├── shBrushPerl.js │ ├── shBrushPowerShell.js │ ├── shBrushPhp.js │ └── shBrushCpp.js ├── adpacks.js └── function-demos-script.js ├── settings.php ├── README.md └── 404page.php /images/bee.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/bee.gif -------------------------------------------------------------------------------- /images/car1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/car1.jpg -------------------------------------------------------------------------------- /images/car2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/car2.jpg -------------------------------------------------------------------------------- /images/car3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/car3.jpg -------------------------------------------------------------------------------- /images/car4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/car4.jpg -------------------------------------------------------------------------------- /images/car5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/car5.jpg -------------------------------------------------------------------------------- /images/404-duh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/404-duh.png -------------------------------------------------------------------------------- /images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/favicon.ico -------------------------------------------------------------------------------- /images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/loading.gif -------------------------------------------------------------------------------- /images/cats-eyes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/cats-eyes.jpg -------------------------------------------------------------------------------- /images/grid-18px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/grid-18px.png -------------------------------------------------------------------------------- /images/sam-deering.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/sam-deering.jpg -------------------------------------------------------------------------------- /images/jquery-books.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/jquery-books.jpg -------------------------------------------------------------------------------- /images/smashing-cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/smashing-cat.png -------------------------------------------------------------------------------- /images/smashing-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/smashing-logo.jpg -------------------------------------------------------------------------------- /functions/css/css-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/css/css-demo.zip -------------------------------------------------------------------------------- /functions/ajax/ajax-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/ajax/ajax-demo.zip -------------------------------------------------------------------------------- /functions/bind/bind-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/bind/bind-demo.zip -------------------------------------------------------------------------------- /functions/data/data-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/data/data-demo.zip -------------------------------------------------------------------------------- /functions/each/each-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/each/each-demo.zip -------------------------------------------------------------------------------- /functions/find/find-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/find/find-demo.zip -------------------------------------------------------------------------------- /functions/html/html-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/html/html-demo.zip -------------------------------------------------------------------------------- /functions/live/live-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/live/live-demo.zip -------------------------------------------------------------------------------- /functions/load/load-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/load/load-demo.zip -------------------------------------------------------------------------------- /functions/next/next-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/next/next-demo.zip -------------------------------------------------------------------------------- /images/twitter-eyes-open.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/twitter-eyes-open.jpg -------------------------------------------------------------------------------- /functions/ajax/images/car1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/ajax/images/car1.jpg -------------------------------------------------------------------------------- /functions/ajax/images/car2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/ajax/images/car2.jpg -------------------------------------------------------------------------------- /functions/ajax/images/car3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/ajax/images/car3.jpg -------------------------------------------------------------------------------- /functions/append/append-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/append/append-demo.zip -------------------------------------------------------------------------------- /functions/clone/clone-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/clone/clone-demo.zip -------------------------------------------------------------------------------- /functions/clone/images/bee.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/clone/images/bee.gif -------------------------------------------------------------------------------- /functions/delay/delay-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/delay/delay-demo.zip -------------------------------------------------------------------------------- /functions/extend/extend-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/extend/extend-demo.zip -------------------------------------------------------------------------------- /functions/filter/filter-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/filter/filter-demo.zip -------------------------------------------------------------------------------- /functions/jsonp/jsonp-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/jsonp/jsonp-demo.zip -------------------------------------------------------------------------------- /functions/match/match-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/match/match-demo.zip -------------------------------------------------------------------------------- /functions/slice/slice-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/slice/slice-demo.zip -------------------------------------------------------------------------------- /images/jquery4u-logo-small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/jquery4u-logo-small.jpg -------------------------------------------------------------------------------- /images/twitter-eyes-closed.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/images/twitter-eyes-closed.jpg -------------------------------------------------------------------------------- /functions/ajax/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/ajax/images/loading.gif -------------------------------------------------------------------------------- /functions/animate/animate-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/animate/animate-demo.zip -------------------------------------------------------------------------------- /functions/animate/images/car1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/animate/images/car1.jpg -------------------------------------------------------------------------------- /functions/animate/images/car2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/animate/images/car2.jpg -------------------------------------------------------------------------------- /functions/animate/images/car3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/animate/images/car3.jpg -------------------------------------------------------------------------------- /functions/animate/images/car4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/animate/images/car4.jpg -------------------------------------------------------------------------------- /functions/animate/images/car5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/animate/images/car5.jpg -------------------------------------------------------------------------------- /functions/getjson/getjson-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/getjson/getjson-demo.zip -------------------------------------------------------------------------------- /functions/jsonp/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/jsonp/images/loading.gif -------------------------------------------------------------------------------- /functions/addclass/addclass-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/addclass/addclass-demo.zip -------------------------------------------------------------------------------- /functions/delegate/delegate-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/delegate/delegate-demo.zip -------------------------------------------------------------------------------- /functions/live/images/cats-eyes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/live/images/cats-eyes.jpg -------------------------------------------------------------------------------- /functions/getscript/getscript-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/getscript/getscript-demo.zip -------------------------------------------------------------------------------- /functions/getscript/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/getscript/images/loading.gif -------------------------------------------------------------------------------- /functions/animate/images/jquery-books.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/animate/images/jquery-books.jpg -------------------------------------------------------------------------------- /functions/fadetoggle/fadetoggle-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/fadetoggle/fadetoggle-demo.zip -------------------------------------------------------------------------------- /functions/setinterval/setinterval-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/setinterval/setinterval-demo.zip -------------------------------------------------------------------------------- /functions/settimeout/settimeout-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/settimeout/settimeout-demo.zip -------------------------------------------------------------------------------- /functions/slidetoggle/slidetoggle-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/slidetoggle/slidetoggle-demo.zip -------------------------------------------------------------------------------- /functions/toggleclass/toggleclass-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/toggleclass/toggleclass-demo.zip -------------------------------------------------------------------------------- /functions/load/load-desc.php: -------------------------------------------------------------------------------- 1 | The $.getScript function is an AJAX shorthand method for inserting HTML straight into a matched element on the web page. -------------------------------------------------------------------------------- /functions/preventdefault/preventdefault-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/preventdefault/preventdefault-demo.zip -------------------------------------------------------------------------------- /functions/serializearray/serializearray-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/serializearray/serializearray-demo.zip -------------------------------------------------------------------------------- /functions/stoppropagation/stoppropagation-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/stoppropagation/stoppropagation-demo.zip -------------------------------------------------------------------------------- /functions/toggleclass/images/twitter-eyes-closed.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/toggleclass/images/twitter-eyes-closed.jpg -------------------------------------------------------------------------------- /functions/toggleclass/images/twitter-eyes-open.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/toggleclass/images/twitter-eyes-open.jpg -------------------------------------------------------------------------------- /functions/setinterval/setinterval-desc.php: -------------------------------------------------------------------------------- 1 | You can automate a task based on time using the JavaScript setInterval() function which can be used to specify a regular time based trigger. -------------------------------------------------------------------------------- /functions/addclass/addclass-desc.php: -------------------------------------------------------------------------------- 1 | In addition to the .css() function you can apply current css styles by using the .addClass() function. It's counterpart function is .removeClass(). -------------------------------------------------------------------------------- /functions/fadetoggle/fadetoggle-desc.php: -------------------------------------------------------------------------------- 1 | The same as .slideToggle() but with a fading effect. The .fadeToggle() uses the popular .fadeIn() and .fadeOut() events to show and hide content on a web page. -------------------------------------------------------------------------------- /functions/stopimmediatepropagation/stopimmediatepropagation-demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdeering/50-jquery-function-demos/HEAD/functions/stopimmediatepropagation/stopimmediatepropagation-demo.zip -------------------------------------------------------------------------------- /functions/slice/slice-desc.php: -------------------------------------------------------------------------------- 1 | The .slice() function allows us to easily specify a subset of elements to perform actions on. It takes two parameters: start and end indices of sub elements in a matched parent element. -------------------------------------------------------------------------------- /data/colors.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors": [ 3 | { 4 | "red": "#f00", 5 | "green": "#0f0", 6 | "blue": "#00f", 7 | "cyan": "#0ff", 8 | "magenta": "#f0f", 9 | "yellow": "#ff0", 10 | "black": "#000", 11 | "white": "#fff" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /functions/find/find-desc.php: -------------------------------------------------------------------------------- 1 | The .find() function is really useful for matching elements filtered by a selector, jQuery object, or element. There is also a function called .children() which only searches the direct child siblings of the matched elements. -------------------------------------------------------------------------------- /functions/getjson/data/colors.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors": [ 3 | { 4 | "red": "#f00", 5 | "green": "#0f0", 6 | "blue": "#00f", 7 | "cyan": "#0ff", 8 | "magenta": "#f0f", 9 | "yellow": "#ff0", 10 | "black": "#000", 11 | "white": "#fff" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /functions/delay/delay-desc.php: -------------------------------------------------------------------------------- 1 | In this demonstration we're going to make use of jQuery's awesome function chaining ability by running .fadeOut(), .fadeIn() and .delay() functions together on the same element. Very similar to the setTimeout function but without the ability to easily interrupt the delay. -------------------------------------------------------------------------------- /functions/slidetoggle/slidetoggle-desc.php: -------------------------------------------------------------------------------- 1 | There are various toggle functions that jQuery provides which save us heaps of time when we want to bind related events to the same element. For example .slideToggle() binds both .slideUp() and .slideDown() to the element and also manages what state for us. -------------------------------------------------------------------------------- /functions/next/next-desc.php: -------------------------------------------------------------------------------- 1 | The .prev() and .next() functions can be used to reference the immediate preceeding element or next element in the set of matched elements (DOM hierarchy). You can also add a selector to the functions which acts as a filter on the elements, this is shown in the example. -------------------------------------------------------------------------------- /functions/toggleclass/toggleclass-desc.php: -------------------------------------------------------------------------------- 1 | The $.toggleClass() function is a huge time saver when it comes to have a state either on or off with CSS. The following example sets event handlers for "mouseenter" (the CSS class "img-hover" will be applied to the img) and and "mouseleave" (CSS class removed). -------------------------------------------------------------------------------- /functions/append/append-desc.php: -------------------------------------------------------------------------------- 1 | .append(), prepend(), .after() and .before()
2 | These functions provide good alternatives to .html() for inserting content into your web page. Although it may appear trivial, they have thier own purpose and it's definately worth knowing exactly where they will place your content to save time. -------------------------------------------------------------------------------- /functions/getscript/getscript-desc.php: -------------------------------------------------------------------------------- 1 | The $.getScript function is an AJAX shorthand method for inserting JavaScript into the web page. This example loads in a geographical location JavaScript file which contains geo location functions we can call to access your current location (or more specifically the location of your ISP). -------------------------------------------------------------------------------- /functions/serializearray/serializearray-desc.php: -------------------------------------------------------------------------------- 1 | The .serializeArray() function can create an array of form fields and thier values in seconds! There are two examples, the first outputs all of the form fields and thier values. The second creates a URL string with the form fields and values appended to the form action ready to be sent. -------------------------------------------------------------------------------- /functions/settimeout/settimeout-desc.php: -------------------------------------------------------------------------------- 1 | You can delay a task based on time using the JavaScript setTimeout() function which can be used to wait for a spcified length of time before running the code.

2 |

There is also another demo: jQuery setTimeout() Function Examples. -------------------------------------------------------------------------------- /functions/clone/clone-desc.php: -------------------------------------------------------------------------------- 1 | The jQuery .clone() function is pretty simple to use and basically just copies the element you specify into a new element. There is also another great example of the .clone() method on the blog Creating web page preview bars using .clone(). -------------------------------------------------------------------------------- /functions/stopimmediatepropagation/stopimmediatepropagation-desc.php: -------------------------------------------------------------------------------- 1 | Nice function to stop all future bound events. The events will fire in the order they were bound and when it hits the .stopImmediatePropagation() function all further bound events are not fired.

2 |

Demo: Preventing all future bound events from firing. -------------------------------------------------------------------------------- /data/content2.html: -------------------------------------------------------------------------------- 1 |

2 |

Lorem ipsum Porttitor ut suscipit lectus elementum leo, est in vivamus, ut rhoncus enim maecenas, odio lectus ut maecenas nulla. Metus eget eget. Congue adipiscing ut elit metus, pellentesque pellentesque ante massa sem volutpat curabitur. Turpis vivamus. Autem justo nisl fusce placerat, in non amet.

3 |
-------------------------------------------------------------------------------- /functions/filter/filter-desc.php: -------------------------------------------------------------------------------- 1 | JQuery provides us with the .filter() function which allows us to reduce a set of matched elements based on a jQuery selector. This is useful when you want to process a group of elements and then further process specific children elements. The .filter() function can be used in a few different ways. You could simply filter by a class name, function or jQuery object. -------------------------------------------------------------------------------- /functions/live/live-desc.php: -------------------------------------------------------------------------------- 1 | The .live() function is essentially the same as .bind() but it can capture events on new elements that didn't exist on the page when it was loaded. For example, if your web page has already loaded and you dynamically insert an image into the page. If we used bind to attach an event when the mouse hovers over the image it would not work. But if we use .live() it will work! -------------------------------------------------------------------------------- /functions/preventdefault/preventdefault-desc.php: -------------------------------------------------------------------------------- 1 | The .preventDefault() function can be applied to stop any element with a default action from firing: hyperlinks, keyboard shortcuts, form submit buttons etc. This example is probably the most common use and it stops a hyperlink from going to its destination (href). It's very useful for stopping those default actions and running your custom JavaScript actions instead. -------------------------------------------------------------------------------- /functions/ajax/data/content2.html: -------------------------------------------------------------------------------- 1 |
2 |

Lorem ipsum Porttitor ut suscipit lectus elementum leo, est in vivamus, ut rhoncus enim maecenas, odio lectus ut maecenas nulla. Metus eget eget. Congue adipiscing ut elit metus, pellentesque pellentesque ante massa sem volutpat curabitur. Turpis vivamus. Autem justo nisl fusce placerat, in non amet.

3 |
-------------------------------------------------------------------------------- /functions/stoppropagation/stoppropagation-desc.php: -------------------------------------------------------------------------------- 1 | Along with .preventDefault() there are other methods which do similar things. The .stopPropagation() function prevents the event from happening on any ancestor elements. This can be used if you have an exception to the rule you specified for an container element with child elements. Also note that this function currently does not work with .live() events as it handles events once they have propagated to the top of the document. -------------------------------------------------------------------------------- /functions/animate/animate-desc.php: -------------------------------------------------------------------------------- 1 | The .animate() function can be used to animate elements on a web page with little effort. The animations could take the form of movement or appearance, lets look at some examples. The jQuery UI project extends the .animate() method by allowing some non-numeric styles such as colors to be animated. You can replace settings with duration (in milliseconds) or words: 'slow', 'normal' or 'fast' and the callback is optional (this is the code that runs after the animation finishes). -------------------------------------------------------------------------------- /functions/css/css-desc.php: -------------------------------------------------------------------------------- 1 | Change your website styles dynamically with jQuery's .css() function. You can change any styles you would normally declare in a Stylesheet such as "color" (text colour), "background-color", "font-size" etc. You can both get and set the current styles for a specified element. I prefer to use the following syntax as it gives greater flexibilty when changing mutiple styles. 2 |
3 |
$('selector').css({
4 |   "property":"value",
5 |   "propertyN":"valueN"
6 | });
-------------------------------------------------------------------------------- /functions/data/data-desc.php: -------------------------------------------------------------------------------- 1 | Updates to jQuery 1.4 has seen the ability to attach data of any type to DOM elements. This is very useful alternative to storing data in JavaScript Objects or such. There are two versions: $.data() which takes in the element as a parameter; or .data() which can attach directly on matched elements. It is worth noting that $.data() returns a data object to the caller whereas .data() does not. There are also many utility functions such as $.hasData(), $.removeData() that help with data management. -------------------------------------------------------------------------------- /functions/jsonp/jsonp-desc.php: -------------------------------------------------------------------------------- 1 | AJAX requests are subject to the same origin policy which means you can only send requests to the same domain. Fortunately, $.ajax() has a property called JSONP (JSON with padding) allows a page to request data from a server in a different domain. It works by wrapping the target data in a JavaScript callback function. It is also worth knowing that the response is not parsed as JSON and can be any JavaScript expression. -------------------------------------------------------------------------------- /data/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "apis": { 3 | "flickr": { 4 | "url": "http://api.flickr.com/services/feeds/groups_pool.gne?id=998875@N22&lang=en-us&format=json&jsoncallback=?" 5 | }, 6 | "twitter": { 7 | "url": "http://twitter.com/statuses/user_timeline/smashingmag.json?callback=twitterCallback2&count=5" 8 | }, 9 | "facebook": { 10 | "url": "http: //twitter.com/api" 11 | }, 12 | "gmaps": { 13 | "url": "http: //twitter.com/api" 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /css/demostyles.css: -------------------------------------------------------------------------------- 1 | .resetbtn { 2 | background-color: red !important; 3 | } 4 | 5 | * { 6 | color: white !important; 7 | background-color: black !important; 8 | background-image: none !important; 9 | } 10 | a { 11 | color: white; 12 | background-color: black; 13 | } 14 | a:hover { 15 | color: orange; 16 | } 17 | .example { 18 | font-weight: bold; 19 | color:orange; 20 | background-color: #1D8478 !important; 21 | } 22 | pre { 23 | background-color: #E5E5E5 !important; 24 | color: black !important; 25 | } 26 | h1, h2, h3, h4 { 27 | color: white; 28 | } -------------------------------------------------------------------------------- /data/content1.html: -------------------------------------------------------------------------------- 1 |
2 |

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse suscipit justo a justo accumsan luctus. In eu dui vitae lacus volutpat cursus nec nec sapien. Integer non dignissim elit. Aenean egestas, purus eu porttitor faucibus, mauris dolor faucibus felis, non lobortis erat quam porta risus. Etiam id tellus quis lectus aliquam convallis. Fusce eget diam eleifend justo posuere tempor ac ac sem. Duis in neque at ipsum semper pretium vitae non nunc.

3 |
-------------------------------------------------------------------------------- /functions/match/match-desc.php: -------------------------------------------------------------------------------- 1 | I have included a couple of Regular Expression examples with JavaScript functions .match() and .test() because I feel it's not used enough for how much time it can save you! Using regex can save you heaps of time when filtering for string values. Once you get your head around the syntax, it's really not that hard. I have also put together a list of Regex Examples to save you time. Let's take a look at some examples. -------------------------------------------------------------------------------- /functions/delegate/delegate-desc.php: -------------------------------------------------------------------------------- 1 | The .delegate() function also provides a way of attaching event handlers to new elements, like was saw in the .live() function demo. You may find that .delegate() is faster than .live() because the latter searches the entire document namespace for the elements as opposed to a single document context. Also, you can specify a jQuery selector to match mutiple events based on a specified set of root elements. -------------------------------------------------------------------------------- /functions/css/css/demostyles.css: -------------------------------------------------------------------------------- 1 | .resetbtn { 2 | background-color: red !important; 3 | } 4 | 5 | * { 6 | color: white !important; 7 | background-color: black !important; 8 | background-image: none !important; 9 | } 10 | a { 11 | color: white; 12 | background-color: black; 13 | } 14 | a:hover { 15 | color: orange; 16 | } 17 | .example { 18 | font-weight: bold; 19 | color:orange; 20 | background-color: #1D8478 !important; 21 | } 22 | pre { 23 | background-color: #E5E5E5 !important; 24 | color: black !important; 25 | } 26 | h1, h2, h3, h4 { 27 | color: white; 28 | } -------------------------------------------------------------------------------- /functions/ajax/data/content1.html: -------------------------------------------------------------------------------- 1 |
2 |

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse suscipit justo a justo accumsan luctus. In eu dui vitae lacus volutpat cursus nec nec sapien. Integer non dignissim elit. Aenean egestas, purus eu porttitor faucibus, mauris dolor faucibus felis, non lobortis erat quam porta risus. Etiam id tellus quis lectus aliquam convallis. Fusce eget diam eleifend justo posuere tempor ac ac sem. Duis in neque at ipsum semper pretium vitae non nunc.

3 |
-------------------------------------------------------------------------------- /functions/each/each-desc.php: -------------------------------------------------------------------------------- 1 | There are two versions of the each method in jQuery - $.each() uses the jQuery namespace and .each() acts directly upon targeted DOM elements. I am a big fan of shorthand techniques and jQuery provides us with a fast alternative to basic JavaScript loops. You can use $.each() and .each() on lots of different things such as DOM Elements, Arrays, Objects, JSON etc. I have 5 more jQuery.each() examples to show you! -------------------------------------------------------------------------------- /functions/html/html-desc.php: -------------------------------------------------------------------------------- 1 | Using .html() is the most common way to get or set the content of an element using jQuery. If you just want the text and not HTML tags you can simply use .text() which will return a string containing the combined text of all matched elements. These functions are browser dependant (ie - .html() uses the browser's innerHTML property) so the results returned(white space, new lines etc) will depend on the browser you are using. In this example we also make use of the .empty() function which is a quick way to get rid of the content within and .prev() which can be used to reference the preceding element, in this case this is the demo buttons. -------------------------------------------------------------------------------- /functions/extend/extend-desc.php: -------------------------------------------------------------------------------- 1 | You can use the .extend() method to merges the contents of two or more objects and store the result in the first object (or a new object). To explain the demo in more detail. We want to add another two forms to our site which already has a functional enquiry form. Instead of copying all the code that processes that form we can use $.extend() to copy the existing functionality for our new forms to avoid redundant code. You may have noticed that the target element specified is a blank object. This is a trick you will often see to create a new object of "object1" and extend it with "objectN" (N represents any number of objects). So in the example we want to "copy" the existing functionality of forms.enquiry and simply override the email address. -------------------------------------------------------------------------------- /data/content3.html: -------------------------------------------------------------------------------- 1 |
2 |

Lorem ipsum Tincidunt potenti donec pellentesque sem dolor, quis porta mauris aptent placerat consequat, dolor fusce aliquam, fringilla nascetur elit eu, wisi felis nihil sociis nec ultricies a. Fusce suspendisse et a ac non, pede scelerisque placerat vehicula tortor, quisque a sit, nisl dolor tortor donec nec condimentum aliquam, ligula quam. Quis dictum sed fringilla nulla, duis wisi voluptatem lectus ut enim hymenaeos. Laoreet placerat et adipiscing donec. Rhoncus turpis rutrum, arcu tellus, mauris amet metus, vestibulum aliquam ornare. Id id ac. Dolor varius, aliquam sed quas tempus libero ullamcorper proin. Ante elit tincidunt hymenaeos egestas, wisi interdum consectetuer eu turpis libero purus, pellentesque quis vestibulum. Eros donec a hendrerit pulvinar sed.

3 |
-------------------------------------------------------------------------------- /functions/getjson/getjson-desc.php: -------------------------------------------------------------------------------- 1 | The $.getJSON() function is an AJAX shorthand method for accessing JSON data files. JavaScript Object Notation (JSON) provides a great way to store and transfer data independantly and it works great with JavaScript (because it's essentially the same notation). There are a few reasons why you might choose JSON over XML.

2 | 3 |

For this demo you can view the JSON file. We can also use functions like $.parseJSON() and JSON.parse() from ECMAScript 5 that simplifies JSON parsing. If you're interested in JSON Parsing and Tree Recursion see JSON Tree Viewer which is very interesting. -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushPlain.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | }; 25 | 26 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 27 | Brush.aliases = ['text', 'plain']; 28 | 29 | SyntaxHighlighter.brushes.Plain = Brush; 30 | 31 | // CommonJS 32 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 33 | })(); 34 | -------------------------------------------------------------------------------- /functions/ajax/data/content3.html: -------------------------------------------------------------------------------- 1 |

2 |

Lorem ipsum Tincidunt potenti donec pellentesque sem dolor, quis porta mauris aptent placerat consequat, dolor fusce aliquam, fringilla nascetur elit eu, wisi felis nihil sociis nec ultricies a. Fusce suspendisse et a ac non, pede scelerisque placerat vehicula tortor, quisque a sit, nisl dolor tortor donec nec condimentum aliquam, ligula quam. Quis dictum sed fringilla nulla, duis wisi voluptatem lectus ut enim hymenaeos. Laoreet placerat et adipiscing donec. Rhoncus turpis rutrum, arcu tellus, mauris amet metus, vestibulum aliquam ornare. Id id ac. Dolor varius, aliquam sed quas tempus libero ullamcorper proin. Ante elit tincidunt hymenaeos egestas, wisi interdum consectetuer eu turpis libero purus, pellentesque quis vestibulum. Eros donec a hendrerit pulvinar sed.

3 |
-------------------------------------------------------------------------------- /functions/bind/bind-desc.php: -------------------------------------------------------------------------------- 1 | The .bind() function is very useful for adding event triggers & handlers to your DOM elements. If you didn't know, there is a whole list of events which you can bind your DOM elements to such as submit, change, mouseenter, mouseleave etc.

2 | 3 |

You may have also seen .click() used in jQuery code. As far as I know, there is no functional difference between .bind('click') and .click() but the benefits lie with much cleaner code (espescially when binding to mutiple events) and the ability to specify custom events and add data parameters.

4 | 5 |

Note: You can also use the .unbind() function to any of the binded events.

6 | 7 |

The key difference between the "keydown" and the "keypress" events is that the latter captures each individual character enetered as opposed to just firing once per key press. I've made a quick only demo to find out the keycodes for any key pressed. -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushDiff.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | this.regexList = [ 25 | { regex: /^\+\+\+.*$/gm, css: 'color2' }, 26 | { regex: /^\-\-\-.*$/gm, css: 'color2' }, 27 | { regex: /^\s.*$/gm, css: 'color1' }, 28 | { regex: /^@@.*@@$/gm, css: 'variable' }, 29 | { regex: /^\+[^\+]{1}.*$/gm, css: 'string' }, 30 | { regex: /^\-[^\-]{1}.*$/gm, css: 'comments' } 31 | ]; 32 | }; 33 | 34 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 35 | Brush.aliases = ['diff', 'patch']; 36 | 37 | SyntaxHighlighter.brushes.Diff = Brush; 38 | 39 | // CommonJS 40 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 41 | })(); 42 | -------------------------------------------------------------------------------- /functions/delay/delay-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 34 | 35 | 36 | 37 | 38 |

Demo: Using .delay() to create a delay between function calls.

39 |

Run Demo View Code

40 |
I will show for 1.5 seconds.
41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shAutoloader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(2(){1 h=5;h.I=2(){2 n(c,a){4(1 d=0;d 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 33 | 34 | 35 | 36 | 37 |

Demo: Using .load() to grab HTML content from another web page

38 |

Run Demo View Code

39 |
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /functions/html/html-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 35 | 36 | 37 | 38 | 39 |

Demo: Getting the content of an element.

40 |

Run Demo View Code

41 |
42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /settings.php: -------------------------------------------------------------------------------- 1 | 44 | -------------------------------------------------------------------------------- /css/style.css: -------------------------------------------------------------------------------- 1 | /* AD PACKS CSS */ 2 | #main-sidebar-ads { padding: 10px 0; width: 200px; background-color: white; } 3 | .adpacks{background:#fff;padding:15px;margin:15px 0 0;border:3px solid #eee;} 4 | .bsa_it_ad{background:transparent;border:none;font-family:inherit;padding:0 15px 0 10px;margin: 10px 0 0;text-align:center;} 5 | .bsa_it_ad a { width:135px; text-decoration:none; border: none; border-bottom:0 !important;} 6 | .bsa_it_t { font-size:14px; text-decoration:none; color:black; display: inline-block; border-bottom:0 !important; padding-left: 5px; } 7 | .bsa_it_d { font-size:12px; text-decoration:none; font-weight:normal; color:black; border-bottom:0 !important; padding-left: 5px; } 8 | .bsa_it_ad:hover img{-moz-box-shadow:0 0 3px #000;-webkit-box-shadow:0 0 3px #000;box-shadow:0 0 3px #000;} 9 | .bsa_it_p{display:none;} 10 | #bsap_aplink,body #bsap_aplink:hover{color:#E0DEDE;display:block;font-size:10px;margin: 0 15px 0 0;text-align:right; text-decoration:none; border: none; border-bottom:0 !important;} 11 | 12 | /* function demos pages */ 13 | #maindemoarea { 14 | margin: 10px 15px 10px 2px; 15 | min-height: 50px; 16 | width: 100%; 17 | } 18 | 19 | .demoarea { 20 | display:none; 21 | margin-bottom:20px; 22 | } 23 | 24 | .expose { 25 | position:relative; 26 | background-color: #FFFFFF; 27 | } 28 | 29 | #overlay { 30 | background:rgba(0,0,0,0.3); 31 | display:none; 32 | width:100%; height:100%; 33 | position:absolute; top:0; left:0; z-index:99998; 34 | } 35 | 36 | pre.raw { 37 | background-color: #F2EFEF; 38 | padding: 10px; 39 | margin-bottom: 10px; 40 | margin-right: 20px; 41 | line-height: 22px; 42 | /*white-space: normal;*/ 43 | } -------------------------------------------------------------------------------- /functions/settimeout/settimeout-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 36 | 37 | 38 | 39 | 40 |

Demo: Doing something after a specified length of time.

41 |

Click "Run Demo" to set the timeout and click "Reset" to clear the timeout.

42 |

Run Demo View Code

43 |
This text will dissapear after 3 seconds.
44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /functions/preventdefault/preventdefault-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 36 | 37 | 38 | 39 | 40 |

Demo: Preventing a hyperlink from going to href.

41 |

Run Demo View Code

42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushJScript.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'break case catch continue ' + 25 | 'default delete do else false ' + 26 | 'for function if in instanceof ' + 27 | 'new null return super switch ' + 28 | 'this throw true try typeof var while with' 29 | ; 30 | 31 | var r = SyntaxHighlighter.regexLib; 32 | 33 | this.regexList = [ 34 | { regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings 35 | { regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings 36 | { regex: r.singleLineCComments, css: 'comments' }, // one line comments 37 | { regex: r.multiLineCComments, css: 'comments' }, // multiline comments 38 | { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 39 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords 40 | ]; 41 | 42 | this.forHtmlScript(r.scriptScriptTags); 43 | }; 44 | 45 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 46 | Brush.aliases = ['js', 'jscript', 'javascript']; 47 | 48 | SyntaxHighlighter.brushes.JScript = Brush; 49 | 50 | // CommonJS 51 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 52 | })(); 53 | -------------------------------------------------------------------------------- /functions/clone/clone-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 40 | 41 | 42 | 43 | 44 |

Demo: Cloning an element

45 |

Run Demo View Code

46 |
47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /functions/fadetoggle/fadetoggle-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 30 | 31 | 32 | 33 | 34 |

Demo: Fade an element in and out of view. Click "Run Demo" to activate fade in/out.

35 |

Run Demo View Code

36 |
37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shLegacy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3 u={8:{}};u.8={A:4(c,k,l,m,n,o){4 d(a,b){2 a!=1?a:b}4 f(a){2 a!=1?a.E():1}c=c.I(":");3 g=c[0],e={};t={"r":K};M=1;5=8.5;9(3 j R c)e[c[j]]="r";k=f(d(k,5.C));l=f(d(l,5.D));m=f(d(m,5.s));o=f(d(o,5.Q));n=f(d(n,5["x-y"]));2{P:g,C:d(t[e.O],k),D:d(t[e.N],l),s:d({"r":r}[e.s],m),"x-y":d(4(a,b){9(3 h=T S("^"+b+"\\\\[(?\\\\w+)\\\\]$","U"),i=1,p=0;p 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 30 | 31 | 32 | 33 | 34 |

Demo: Sliding an element in and out of view.

35 |

Click "Run Demo" to slide the div in and out of view.

36 |

Run Demo View Code

37 |
38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushErlang.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Jean-Lou Dupont 25 | // http://jldupont.blogspot.com/2009/06/erlang-syntax-highlighter.html 26 | 27 | // According to: http://erlang.org/doc/reference_manual/introduction.html#1.5 28 | var keywords = 'after and andalso band begin bnot bor bsl bsr bxor '+ 29 | 'case catch cond div end fun if let not of or orelse '+ 30 | 'query receive rem try when xor'+ 31 | // additional 32 | ' module export import define'; 33 | 34 | this.regexList = [ 35 | { regex: new RegExp("[A-Z][A-Za-z0-9_]+", 'g'), css: 'constants' }, 36 | { regex: new RegExp("\\%.+", 'gm'), css: 'comments' }, 37 | { regex: new RegExp("\\?[A-Za-z0-9_]+", 'g'), css: 'preprocessor' }, 38 | { regex: new RegExp("[a-z0-9_]+:[a-z0-9_]+", 'g'), css: 'functions' }, 39 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, 40 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } 42 | ]; 43 | }; 44 | 45 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 46 | Brush.aliases = ['erl', 'erlang']; 47 | 48 | SyntaxHighlighter.brushes.Erland = Brush; 49 | 50 | // CommonJS 51 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 52 | })(); 53 | -------------------------------------------------------------------------------- /functions/toggleclass/toggleclass-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 36 | 37 | 45 | 46 | 47 | 48 | 49 |

Example: Toggling a CSS class on an element.

50 |

Run Demo View Code

51 |
52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /functions/getscript/getscript-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 36 | 37 | 44 | 45 | 46 | 47 | 48 |

Demo: Using $.getScript() to dynamically load a JavaScript file.

49 |

Run Demo View Code

50 |
51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushScala.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Yegor Jbanov and David Bernard. 25 | 26 | var keywords = 'val sealed case def true trait implicit forSome import match object null finally super ' + 27 | 'override try lazy for var catch throw type extends class while with new final yield abstract ' + 28 | 'else do if return protected private this package false'; 29 | 30 | var keyops = '[_:=><%#@]+'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 35 | { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // multi-line strings 36 | { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double-quoted string 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /0x[a-f0-9]+|\d+(\.\d+)?/gi, css: 'value' }, // numbers 39 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 40 | { regex: new RegExp(keyops, 'gm'), css: 'keyword' } // scala keyword 41 | ]; 42 | } 43 | 44 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 45 | Brush.aliases = ['scala']; 46 | 47 | SyntaxHighlighter.brushes.Scala = Brush; 48 | 49 | // CommonJS 50 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 51 | })(); 52 | -------------------------------------------------------------------------------- /functions/getjson/getjson-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 46 | 47 | 48 | 49 | 50 |

Demo: Using $.getJSON() to populate options in a drop down list.

51 |

Run Demo View Code

52 |
53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /functions/live/live-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 42 | 43 | 44 | 45 | 46 |

Example: Capturing events on new or changed elements.

47 |

When the mouse moves through the div it toggles the background image class to show twitter eyes open.

48 |

Click "Run Demo" to dynamically insert a div element with a black background. When the div is hovered it loads in a background image.

49 |

Run Demo View Code

50 |
51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushXml.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | function process(match, regexInfo) 25 | { 26 | var constructor = SyntaxHighlighter.Match, 27 | code = match[0], 28 | tag = new XRegExp('(<|<)[\\s\\/\\?]*(?[:\\w-\\.]+)', 'xg').exec(code), 29 | result = [] 30 | ; 31 | 32 | if (match.attributes != null) 33 | { 34 | var attributes, 35 | regex = new XRegExp('(? [\\w:\\-\\.]+)' + 36 | '\\s*=\\s*' + 37 | '(? ".*?"|\'.*?\'|\\w+)', 38 | 'xg'); 39 | 40 | while ((attributes = regex.exec(code)) != null) 41 | { 42 | result.push(new constructor(attributes.name, match.index + attributes.index, 'color1')); 43 | result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string')); 44 | } 45 | } 46 | 47 | if (tag != null) 48 | result.push( 49 | new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword') 50 | ); 51 | 52 | return result; 53 | } 54 | 55 | this.regexList = [ 56 | { regex: new XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), css: 'color2' }, // 57 | { regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // 58 | { regex: new XRegExp('(<|<)[\\s\\/\\?]*(\\w+)(?.*?)[\\s\\/\\?]*(>|>)', 'sg'), func: process } 59 | ]; 60 | }; 61 | 62 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 63 | Brush.aliases = ['xml', 'xhtml', 'xslt', 'html']; 64 | 65 | SyntaxHighlighter.brushes.Xml = Brush; 66 | 67 | // CommonJS 68 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 69 | })(); 70 | -------------------------------------------------------------------------------- /css/github.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | github.com style (c) Vasily Polovnyov 4 | 5 | */ 6 | 7 | pre code { 8 | display: block; padding: 0.5em; 9 | color: #000; 10 | background: #f8f8ff 11 | } 12 | 13 | pre .comment, 14 | pre .template_comment, 15 | pre .diff .header, 16 | pre .javadoc { 17 | color: #998; 18 | font-style: italic 19 | } 20 | 21 | pre .keyword, 22 | pre .css .rule .keyword, 23 | pre .winutils, 24 | pre .javascript .title, 25 | pre .lisp .title, 26 | pre .subst { 27 | color: #000; 28 | font-weight: bold 29 | } 30 | 31 | pre .number, 32 | pre .hexcolor { 33 | color: #40a070 34 | } 35 | 36 | pre .string, 37 | pre .tag .value, 38 | pre .phpdoc, 39 | pre .tex .formula { 40 | color: #d14 41 | } 42 | 43 | pre .title, 44 | pre .id { 45 | color: #900; 46 | font-weight: bold 47 | } 48 | 49 | pre .javascript .title, 50 | pre .lisp .title, 51 | pre .subst { 52 | font-weight: normal 53 | } 54 | 55 | pre .class .title, 56 | pre .haskell .label, 57 | pre .tex .command { 58 | color: #458; 59 | font-weight: bold 60 | } 61 | 62 | pre .tag, 63 | pre .tag .title, 64 | pre .rules .property, 65 | pre .django .tag .keyword { 66 | color: #000080; 67 | font-weight: normal 68 | } 69 | 70 | pre .attribute, 71 | pre .variable, 72 | pre .instancevar, 73 | pre .lisp .body { 74 | color: #008080 75 | } 76 | 77 | pre .regexp { 78 | color: #009926 79 | } 80 | 81 | pre .class { 82 | color: #458; 83 | font-weight: bold 84 | } 85 | 86 | pre .symbol, 87 | pre .ruby .symbol .string, 88 | pre .ruby .symbol .keyword, 89 | pre .ruby .symbol .keymethods, 90 | pre .lisp .keyword, 91 | pre .tex .special, 92 | pre .input_number { 93 | color: #990073 94 | } 95 | 96 | pre .builtin, 97 | pre .built_in, 98 | pre .lisp .title { 99 | color: #0086b3 100 | } 101 | 102 | pre .preprocessor, 103 | pre .pi, 104 | pre .doctype, 105 | pre .shebang, 106 | pre .cdata { 107 | color: #999; 108 | font-weight: bold 109 | } 110 | 111 | pre .deletion { 112 | background: #fdd 113 | } 114 | 115 | pre .addition { 116 | background: #dfd 117 | } 118 | 119 | pre .diff .change { 120 | background: #0086b3 121 | } 122 | 123 | pre .chunk { 124 | color: #aaa 125 | } 126 | 127 | pre .tex .formula { 128 | opacity: 0.5; 129 | } 130 | -------------------------------------------------------------------------------- /functions/addclass/addclass-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 35 | 36 | 55 | 56 | 57 | 58 | 59 |

Demo: Adding a CSS class to an element.

60 |

Click "Run Demo" to add the styles to the button. Click "Reset" to remove styles.

61 |

Run Demo View Code

62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 25 | 'continue default do double else enum extends ' + 26 | 'false final finally float for goto if implements import ' + 27 | 'instanceof int interface long native new null ' + 28 | 'package private protected public return ' + 29 | 'short static strictfp super switch synchronized this throw throws true ' + 30 | 'transient try void volatile while'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 35 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 39 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 40 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 42 | ]; 43 | 44 | this.forHtmlScript({ 45 | left : /(<|<)%[@!=]?/g, 46 | right : /%(>|>)/g 47 | }); 48 | }; 49 | 50 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 51 | Brush.aliases = ['java']; 52 | 53 | SyntaxHighlighter.brushes.Java = Brush; 54 | 55 | // CommonJS 56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 57 | })(); 58 | -------------------------------------------------------------------------------- /functions/jsonp/jsonp-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 47 | 48 | 49 | 50 | 51 |

Demo: AJAX & JSONP to load data from an external source.

52 |

This demo will load the latest pictures tagged "jQuery" from Flickr Public Feed.

53 |

Run Demo View Code

54 |
55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushRuby.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Erik Peterson. 25 | 26 | var keywords = 'alias and BEGIN begin break case class def define_method defined do each else elsif ' + 27 | 'END end ensure false for if in module new next nil not or raise redo rescue retry return ' + 28 | 'self super then throw true undef unless until when while yield'; 29 | 30 | var builtins = 'Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload ' + 31 | 'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ' + 32 | 'ThreadGroup Thread Time TrueClass'; 33 | 34 | this.regexList = [ 35 | { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 38 | { regex: /\b[A-Z0-9_]+\b/g, css: 'constants' }, // constants 39 | { regex: /:[a-z][A-Za-z0-9_]*/g, css: 'color2' }, // symbols 40 | { regex: /(\$|@@|@)\w+/g, css: 'variable bold' }, // $global, @instance, and @@class variables 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 42 | { regex: new RegExp(this.getKeywords(builtins), 'gm'), css: 'color1' } // builtins 43 | ]; 44 | 45 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 46 | }; 47 | 48 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 49 | Brush.aliases = ['ruby', 'rails', 'ror', 'rb']; 50 | 51 | SyntaxHighlighter.brushes.Ruby = Brush; 52 | 53 | // CommonJS 54 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 55 | })(); 56 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushJavaFX.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Patrick Webster 25 | // http://patrickwebster.blogspot.com/2009/04/javafx-brush-for-syntaxhighlighter.html 26 | var datatypes = 'Boolean Byte Character Double Duration ' 27 | + 'Float Integer Long Number Short String Void' 28 | ; 29 | 30 | var keywords = 'abstract after and as assert at before bind bound break catch class ' 31 | + 'continue def delete else exclusive extends false finally first for from ' 32 | + 'function if import in indexof init insert instanceof into inverse last ' 33 | + 'lazy mixin mod nativearray new not null on or override package postinit ' 34 | + 'protected public public-init public-read replace return reverse sizeof ' 35 | + 'step super then this throw true try tween typeof var where while with ' 36 | + 'attribute let private readonly static trigger' 37 | ; 38 | 39 | this.regexList = [ 40 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, 41 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, 42 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, 43 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, 44 | { regex: /(-?\.?)(\b(\d*\.?\d+|\d+\.?\d*)(e[+-]?\d+)?|0x[a-f\d]+)\b\.?/gi, css: 'color2' }, // numbers 45 | { regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'variable' }, // datatypes 46 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } 47 | ]; 48 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 49 | }; 50 | 51 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 52 | Brush.aliases = ['jfx', 'javafx']; 53 | 54 | SyntaxHighlighter.brushes.JavaFX = Brush; 55 | 56 | // CommonJS 57 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 58 | })(); 59 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushVb.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto ' + 25 | 'Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate ' + 26 | 'CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType ' + 27 | 'Date Decimal Declare Default Delegate Dim DirectCast Do Double Each ' + 28 | 'Else ElseIf End Enum Erase Error Event Exit False Finally For Friend ' + 29 | 'Function Get GetType GoSub GoTo Handles If Implements Imports In ' + 30 | 'Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module ' + 31 | 'MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing ' + 32 | 'NotInheritable NotOverridable Object On Option Optional Or OrElse ' + 33 | 'Overloads Overridable Overrides ParamArray Preserve Private Property ' + 34 | 'Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume ' + 35 | 'Return Select Set Shadows Shared Short Single Static Step Stop String ' + 36 | 'Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until ' + 37 | 'Variant When While With WithEvents WriteOnly Xor'; 38 | 39 | this.regexList = [ 40 | { regex: /'.*$/gm, css: 'comments' }, // one line comments 41 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 42 | { regex: /^\s*#.*$/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 43 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // vb keyword 44 | ]; 45 | 46 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 47 | }; 48 | 49 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 50 | Brush.aliases = ['vb', 'vbnet']; 51 | 52 | SyntaxHighlighter.brushes.Vb = Brush; 53 | 54 | // CommonJS 55 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 56 | })(); 57 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushDelphi.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abs addr and ansichar ansistring array as asm begin boolean byte cardinal ' + 25 | 'case char class comp const constructor currency destructor div do double ' + 26 | 'downto else end except exports extended false file finalization finally ' + 27 | 'for function goto if implementation in inherited int64 initialization ' + 28 | 'integer interface is label library longint longword mod nil not object ' + 29 | 'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended ' + 30 | 'pint64 pointer private procedure program property pshortstring pstring ' + 31 | 'pvariant pwidechar pwidestring protected public published raise real real48 ' + 32 | 'record repeat set shl shortint shortstring shr single smallint string then ' + 33 | 'threadvar to true try type unit until uses val var varirnt while widechar ' + 34 | 'widestring with word write writeln xor'; 35 | 36 | this.regexList = [ 37 | { regex: /\(\*[\s\S]*?\*\)/gm, css: 'comments' }, // multiline comments (* *) 38 | { regex: /{(?!\$)[\s\S]*?}/gm, css: 'comments' }, // multiline comments { } 39 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line 40 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 41 | { regex: /\{\$[a-zA-Z]+ .+\}/g, css: 'color1' }, // compiler Directives and Region tags 42 | { regex: /\b[\d\.]+\b/g, css: 'value' }, // numbers 12345 43 | { regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // numbers $F5D3 44 | { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword 45 | ]; 46 | }; 47 | 48 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 49 | Brush.aliases = ['delphi', 'pascal', 'pas']; 50 | 51 | SyntaxHighlighter.brushes.Delphi = Brush; 52 | 53 | // CommonJS 54 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 55 | })(); 56 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushAS3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Created by Peter Atoria @ http://iAtoria.com 25 | 26 | var inits = 'class interface function package'; 27 | 28 | var keywords = '-Infinity ...rest Array as AS3 Boolean break case catch const continue Date decodeURI ' + 29 | 'decodeURIComponent default delete do dynamic each else encodeURI encodeURIComponent escape ' + 30 | 'extends false final finally flash_proxy for get if implements import in include Infinity ' + 31 | 'instanceof int internal is isFinite isNaN isXMLName label namespace NaN native new null ' + 32 | 'Null Number Object object_proxy override parseFloat parseInt private protected public ' + 33 | 'return set static String super switch this throw true try typeof uint undefined unescape ' + 34 | 'use void while with' 35 | ; 36 | 37 | this.regexList = [ 38 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 39 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 40 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 41 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 42 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 43 | { regex: new RegExp(this.getKeywords(inits), 'gm'), css: 'color3' }, // initializations 44 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 45 | { regex: new RegExp('var', 'gm'), css: 'variable' }, // variable 46 | { regex: new RegExp('trace', 'gm'), css: 'color1' } // trace 47 | ]; 48 | 49 | this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags); 50 | }; 51 | 52 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 53 | Brush.aliases = ['actionscript3', 'as3']; 54 | 55 | SyntaxHighlighter.brushes.AS3 = Brush; 56 | 57 | // CommonJS 58 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 59 | })(); 60 | -------------------------------------------------------------------------------- /functions/ajax/ajax-desc.php: -------------------------------------------------------------------------------- 1 | The jQuery library has a full suite of AJAX capabilities which allows us to load data from a server without refresh the browser page. In this section, we will have a quick look at refreshing page content, loading scripts and retrieveing data from different web pages/servers.

2 | 3 |

$.ajax()

4 |

$.ajax() is arguably the most revolutionary jQuery function. It provides us with means of dynamically loading content, scripts and data and using them on our live web page. Other common uses include submitting a form using AJAX and sending data to server side scripts which can store it in a database.

5 | 6 |

Important AJAX settings to note:

7 |
    8 |
  • url - The target of the request.
  • 9 |
  • type - The type of HTTP request either: "GET" (Default) or "POST".
    Difference between GET and POST.
  • 10 |
  • async - Set asyncronous to TRUE if you want it to load in background and this will allow you to run mutiple AJAX requests at the same time. If you set to FALSE the request will run and then wait for the result before preceeding with the rest of you code.
  • 11 |
  • data - Specify data you wish to pass with the AJAX call in "{param1: 'value1'}" format.
  • 12 |
  • dataType - Specify the type of data that is returned: "xml/html/script/json/jsonp".
  • 13 |
  • success - The function that is fired when the AJAX call has completed successfully.
  • 14 |
  • error - The function that is fired when the AJAX call encountered errors.
  • 15 |
  • jsonp - Allows you to specify a callback function when making cross domain AJAX calls.
  • 16 |
  • timeout - You can also set a timeout on the AJAX call in milliseconds.
  • 17 |
18 | 19 |

As you can see $.ajax() has lots of settings (I have only listed the main ones above). In light of this, they have provided us with many shorthand methods already contain the settings we require. I know some developers who still like to write the full AJAX settings out. Reasons for this might be that they wish to see all the settings to be sure or .get() and $.post() failed to return errors in jQuery < 1.5 which I believe has since been fixed. It is also worth knowing that you can use the Firebug NET.panel to Analyse HTTP Requests for testing, monitoring & debugging AJAX calls. -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushPython.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Gheorghe Milas and Ahmad Sherif 25 | 26 | var keywords = 'and assert break class continue def del elif else ' + 27 | 'except exec finally for from global if import in is ' + 28 | 'lambda not or pass print raise return try yield while'; 29 | 30 | var funcs = '__import__ abs all any apply basestring bin bool buffer callable ' + 31 | 'chr classmethod cmp coerce compile complex delattr dict dir ' + 32 | 'divmod enumerate eval execfile file filter float format frozenset ' + 33 | 'getattr globals hasattr hash help hex id input int intern ' + 34 | 'isinstance issubclass iter len list locals long map max min next ' + 35 | 'object oct open ord pow print property range raw_input reduce ' + 36 | 'reload repr reversed round set setattr slice sorted staticmethod ' + 37 | 'str sum super tuple type type unichr unicode vars xrange zip'; 38 | 39 | var special = 'None True False self cls class_'; 40 | 41 | this.regexList = [ 42 | { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, 43 | { regex: /^\s*@\w+/gm, css: 'decorator' }, 44 | { regex: /(['\"]{3})([^\1])*?\1/gm, css: 'comments' }, 45 | { regex: /"(?!")(?:\.|\\\"|[^\""\n])*"/gm, css: 'string' }, 46 | { regex: /'(?!')(?:\.|(\\\')|[^\''\n])*'/gm, css: 'string' }, 47 | { regex: /\+|\-|\*|\/|\%|=|==/gm, css: 'keyword' }, 48 | { regex: /\b\d+\.?\w*/g, css: 'value' }, 49 | { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, 50 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, 51 | { regex: new RegExp(this.getKeywords(special), 'gm'), css: 'color1' } 52 | ]; 53 | 54 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 55 | }; 56 | 57 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 58 | Brush.aliases = ['py', 'python']; 59 | 60 | SyntaxHighlighter.brushes.Python = Brush; 61 | 62 | // CommonJS 63 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 64 | })(); 65 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushCSharp.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract as base bool break byte case catch char checked class const ' + 25 | 'continue decimal default delegate do double else enum event explicit ' + 26 | 'extern false finally fixed float for foreach get goto if implicit in int ' + 27 | 'interface internal is lock long namespace new null object operator out ' + 28 | 'override params private protected public readonly ref return sbyte sealed set ' + 29 | 'short sizeof stackalloc static string struct switch this throw true try ' + 30 | 'typeof uint ulong unchecked unsafe ushort using virtual void while'; 31 | 32 | function fixComments(match, regexInfo) 33 | { 34 | var css = (match[0].indexOf("///") == 0) 35 | ? 'color1' 36 | : 'comments' 37 | ; 38 | 39 | return [new SyntaxHighlighter.Match(match[0], match.index, css)]; 40 | } 41 | 42 | this.regexList = [ 43 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, func : fixComments }, // one line comments 44 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 45 | { regex: /@"(?:[^"]|"")*"/g, css: 'string' }, // @-quoted strings 46 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 47 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 48 | { regex: /^\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 49 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // c# keyword 50 | { regex: /\bpartial(?=\s+(?:class|interface|struct)\b)/g, css: 'keyword' }, // contextual keyword: 'partial' 51 | { regex: /\byield(?=\s+(?:return|break)\b)/g, css: 'keyword' } // contextual keyword: 'yield' 52 | ]; 53 | 54 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 55 | }; 56 | 57 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 58 | Brush.aliases = ['c#', 'c-sharp', 'csharp']; 59 | 60 | SyntaxHighlighter.brushes.CSharp = Brush; 61 | 62 | // CommonJS 63 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 64 | })(); 65 | 66 | -------------------------------------------------------------------------------- /functions/css/css-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 53 | 54 | 55 | 56 | 57 |

Demo 1: Changing text colour and background colour

58 |

Run Demo View Code

59 |

Blue text with orange background.

60 | 61 |

Demo 2: Adding a stylesheet.

62 |

Run Demo View Code

63 |
64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /functions/next/next-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 51 | 52 | 62 | 63 | 64 | 65 | 66 |

Demo: Referencing the previous/next elements in a list.

67 |

Run Demo View Code

68 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /functions/stoppropagation/stoppropagation-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 49 | 50 | 51 | 52 | 53 |

Demo: Preventing parent container from firing it's event when it's child is clicked.

54 |

Run Demo View Code

55 |
56 | This div doesn't use the .stopPropagation() function. 57 |
58 | This div does use the .stopPropagation() function. 59 | 60 |

As you can see when you click the top link it also fires off the div event but the bottom link uses .stopPropagation() which prevents the div event from firing. The div event will still fire when you click inside the div as expected.

61 |
62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **50 jQuery Function Demos** 2 | ============================ 3 | 4 | This repo contains the entire code listing of the demos for my Smashing Magazine post 50 Useful jQuery Function Demos For Your Projects. 5 | 6 | **Big Social Impact (as at 11/10/2013)** 7 | 8 | 9 | 1,322 Facebook Shares 10 | 11 | 1,559 Tweets 12 | 13 | 549 Delicious Bookmarks 14 | 15 | 310 Google Plus Shares 16 | 17 | 326 LinkedIn Shares 18 | 19 | 127 comments 20 | 21 | 22 | 23 | **Updates & Pull Requests** 24 | 25 | I would like to get these functions up to date and working with the latest versions of jQuery so please fork and submit pull requests so we can make this happen. 26 | 27 | 28 | **Function URL List** 29 | 30 | 31 | **AJAX** 32 | 33 | http://www.jquery4u.com/function-demos/ajax/ 34 | 35 | http://www.jquery4u.com/function-demos/getjson/ 36 | 37 | http://www.jquery4u.com/function-demos/getscript/ 38 | 39 | http://www.jquery4u.com/function-demos/load/ 40 | 41 | http://www.jquery4u.com/function-demos/jsonp/ 42 | 43 | 44 | 45 | **Animations & Effects** 46 | 47 | http://www.jquery4u.com/function-demos/animate/ 48 | 49 | http://www.jquery4u.com/function-demos/setinterval/ 50 | 51 | http://www.jquery4u.com/function-demos/settimeout/ 52 | 53 | http://www.jquery4u.com/function-demos/slidetoggle/ 54 | 55 | http://www.jquery4u.com/function-demos/fadetoggle/ 56 | 57 | http://www.jquery4u.com/function-demos/delay/ 58 | 59 | 60 | 61 | **DOM Manipulation** 62 | 63 | http://www.jquery4u.com/function-demos/css/ 64 | 65 | http://www.jquery4u.com/function-demos/addclass/ 66 | 67 | http://www.jquery4u.com/function-demos/toggleclass/ 68 | 69 | 70 | http://www.jquery4u.com/function-demos/html/ 71 | 72 | http://www.jquery4u.com/function-demos/append/ 73 | 74 | http://www.jquery4u.com/function-demos/clone/ 75 | 76 | 77 | 78 | **Events** 79 | 80 | http://www.jquery4u.com/function-demos/bind/ 81 | 82 | http://www.jquery4u.com/function-demos/live/ 83 | 84 | http://www.jquery4u.com/function-demos/delegate/ 85 | 86 | http://www.jquery4u.com/function-demos/preventdefault/ 87 | 88 | http://www.jquery4u.com/function-demos/stoppropagation/ 89 | 90 | http://www.jquery4u.com/function-demos/stopimmediatepropagation/ 91 | 92 | 93 | 94 | **Traversing & Data** 95 | 96 | http://www.jquery4u.com/function-demos/each/ 97 | 98 | http://www.jquery4u.com/function-demos/data/ 99 | 100 | http://www.jquery4u.com/function-demos/match/ 101 | 102 | http://www.jquery4u.com/function-demos/find/ 103 | 104 | http://www.jquery4u.com/function-demos/filter/ 105 | 106 | http://www.jquery4u.com/function-demos/slice/ 107 | 108 | http://www.jquery4u.com/function-demos/next/ 109 | 110 | http://www.jquery4u.com/function-demos/extend/ 111 | 112 | http://www.jquery4u.com/function-demos/serializearray/ 113 | -------------------------------------------------------------------------------- /functions/slice/slice-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 10 | 43 | 44 | 49 | 50 | 51 | 52 | 53 |

Demo: Using .slice() to perform actions on a subset of elements.

54 |

Run Demo View Code

55 |
56 |
57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 |
Slice 1Slice 2Slice 3
111
123
142
730
361
69 | 70 |
71 |
72 | 73 |
74 |
75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushBash.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'if fi then elif else for do done until while break continue case function return in eq ne ge le'; 25 | var commands = 'alias apropos awk basename bash bc bg builtin bzip2 cal cat cd cfdisk chgrp chmod chown chroot' + 26 | 'cksum clear cmp comm command cp cron crontab csplit cut date dc dd ddrescue declare df ' + 27 | 'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' + 28 | 'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' + 29 | 'free fsck ftp gawk getopts grep groups gzip hash head history hostname id ifconfig ' + 30 | 'import install join kill less let ln local locate logname logout look lpc lpr lprint ' + 31 | 'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' + 32 | 'mv netstat nice nl nohup nslookup open op passwd paste pathchk ping popd pr printcap ' + 33 | 'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' + 34 | 'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' + 35 | 'sleep sort source split ssh strace su sudo sum symlink sync tail tar tee test time ' + 36 | 'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' + 37 | 'uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' + 38 | 'vi watch wc whereis which who whoami Wget xargs yes' 39 | ; 40 | 41 | this.regexList = [ 42 | { regex: /^#!.*$/gm, css: 'preprocessor bold' }, 43 | { regex: /\/[\w-\/]+/gm, css: 'plain' }, 44 | { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments 45 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 46 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 47 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 48 | { regex: new RegExp(this.getKeywords(commands), 'gm'), css: 'functions' } // commands 49 | ]; 50 | } 51 | 52 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 53 | Brush.aliases = ['bash', 'shell']; 54 | 55 | SyntaxHighlighter.brushes.Bash = Brush; 56 | 57 | // CommonJS 58 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 59 | })(); 60 | -------------------------------------------------------------------------------- /functions/delegate/delegate-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 62 | 63 | 67 | 68 | 69 | 70 | 71 |

Demo: Delegating events to child elements of a root element.

72 |

The demo area is the root element (orange border) with coloured span child elements which have a hover event attached.

73 |

Run Demo View Code

74 |
75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /js/adpacks.js: -------------------------------------------------------------------------------- 1 | jQuery(function($){ 2 | 3 | // AdPacks CSS 4 | var css = '\ 5 | #bsaHolder{ right: 25px;position: absolute; top: 0; width: 375px;z-index: 10;}\ 6 | #bsaHolder span{ text-shadow:1px 1px 0 #fff;}\ 7 | #bsap_aplink,\ 8 | #bsap_aplink:visited{ bottom: 10px;color: #aaa;font: 11px arial, sans-serif;position: absolute;right: 14px;border:none;}\ 9 | #bsaHolder .bsa_it_p{ display:none;}\ 10 | #bsaHolder .bsa_it_ad{ height: 110px; font-size: 12px; background: -moz-linear-gradient(#F3F3F3, #FFFFFF, #F3F3F3) repeat scroll 0 0 transparent; background: -webkit-gradient(linear,0% 0%,0% 100%,color-stop(0, #f3f3f3),color-stop(0.5, #fff),color-stop(1, #f3f3f3)); background-color:#f4f4f4;\ 11 | border-color: #fff;overflow: hidden;padding: 10px 10px 0;-moz-box-shadow: 0 0 2px #999;-webkit-box-shadow: 0 0 2px #999;box-shadow: 0 0 2px #999;\ 12 | -moz-border-radius: 0 0 4px 4px;-webkit-border-radius: 0 0 4px 4px;border-radius: 0 0 4px 4px;}\ 13 | #bsaHolder img{ display:block;border:none;float: left;}\ 14 | #bsa_closeAd{ width:15px;height:15px;overflow:hidden;position:absolute;top:10px;right:11px;border:none !important;\ 15 | text-decoration:none !important;background:url("http://www.jquery4u.com/demos/images/x_icon.png") no-repeat;}\ 16 | #bsa_closeAd:hover{ background-position:left bottom;}\ 17 | .bsa_it_t { font-size: 14px !important; color: black; display: inline-block; font-weight: bold; margin-bottom:\5px; padding-left: 10px; width: 200px; margin-bottom: 10px; }\ .bsa_it_d { color: black; display: block; margin-left: 130px; padding: 10px; }\ 18 | #bsaHolder a { text-decoration: none; }\ 19 | '; 20 | 21 | addStyle(css); 22 | 23 | // AdPacks markup 24 | $('body').prepend('
\ 25 | \ 26 |
\ 27 | via Ad Packs\ 28 |
'); 29 | 30 | // $('',{ 31 | // href:'', 32 | // id:'bsa_closeAd', 33 | // title:'Hide this Ad!', 34 | // click:function(){ 35 | // $(this).parent().remove(); 36 | // return false; 37 | // } 38 | // }).appendTo('#bsaHolder'); 39 | 40 | $('#bsa_closeAd').bind('click', function(e) { 41 | e.preventDefault(); 42 | $('#bsaHolder').remove(); 43 | return false; 44 | }); 45 | 46 | // AdPacks.com ad code 47 | (function(){ 48 | var bsa = document.createElement('script'); 49 | bsa.type = 'text/javascript'; 50 | bsa.async = true; 51 | bsa.src = '//s3.buysellads.com/ac/bsa.js'; 52 | (document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(bsa); 53 | })(); 54 | 55 | 56 | function addStyle(str){ 57 | var style = document.createElement('style'); 58 | 59 | style.setAttribute("type", "text/css"); 60 | if (style.styleSheet) { // IE 61 | style.styleSheet.cssText = str; 62 | } else { // the world 63 | style.appendChild(document.createTextNode(str)); 64 | } 65 | 66 | jQuery('head').append(style); 67 | $('html').css('background-attachment','scroll'); 68 | } 69 | }); -------------------------------------------------------------------------------- /functions/append/append-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 56 | 57 | 58 | 59 | 60 |

Demo: Inserting content into your web page.

61 |

Run Demo View Code

62 |
63 | txt = 'This is the content we wish to insert.'
64 | innerDiv.append(txt) | innerDiv.prepend(txt) | innerDiv.after(txt) | innerDiv.before(txt)
65 |

outerDiv

66 |

innerDiv

67 |
68 |
69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /functions/data/data-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 59 | 60 | 61 | 62 | 63 |

Demo: Attaching data to DOM elements.

64 |

The following example set/get a data object onto the div for this demo area.

65 |

Run Demo View Code

66 |
67 |
68 |
69 | Set data | Get data | Has data? | Remove data 70 |
71 |
72 | Data: 73 |
74 |
75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushGroovy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Andres Almiray 25 | // http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter 26 | 27 | var keywords = 'as assert break case catch class continue def default do else extends finally ' + 28 | 'if in implements import instanceof interface new package property return switch ' + 29 | 'throw throws try while public protected private static'; 30 | var types = 'void boolean byte char short int long float double'; 31 | var constants = 'null'; 32 | var methods = 'allProperties count get size '+ 33 | 'collect each eachProperty eachPropertyName eachWithIndex find findAll ' + 34 | 'findIndexOf grep inject max min reverseEach sort ' + 35 | 'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' + 36 | 'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' + 37 | 'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' + 38 | 'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' + 39 | 'transformChar transformLine withOutputStream withPrintWriter withStream ' + 40 | 'withStreams withWriter withWriterAppend write writeLine '+ 41 | 'dump inspect invokeMethod print println step times upto use waitForOrKill '+ 42 | 'getText'; 43 | 44 | this.regexList = [ 45 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 46 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 47 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 48 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 49 | { regex: /""".*"""/g, css: 'string' }, // GStrings 50 | { regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'value' }, // numbers 51 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // goovy keyword 52 | { regex: new RegExp(this.getKeywords(types), 'gm'), css: 'color1' }, // goovy/java type 53 | { regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants' }, // constants 54 | { regex: new RegExp(this.getKeywords(methods), 'gm'), css: 'functions' } // methods 55 | ]; 56 | 57 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 58 | } 59 | 60 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 61 | Brush.aliases = ['groovy']; 62 | 63 | SyntaxHighlighter.brushes.Groovy = Brush; 64 | 65 | // CommonJS 66 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 67 | })(); 68 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushSql.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var funcs = 'abs avg case cast coalesce convert count current_timestamp ' + 25 | 'current_user day isnull left lower month nullif replace right ' + 26 | 'session_user space substring sum system_user upper user year'; 27 | 28 | var keywords = 'absolute action add after alter as asc at authorization begin bigint ' + 29 | 'binary bit by cascade char character check checkpoint close collate ' + 30 | 'column commit committed connect connection constraint contains continue ' + 31 | 'create cube current current_date current_time cursor database date ' + 32 | 'deallocate dec decimal declare default delete desc distinct double drop ' + 33 | 'dynamic else end end-exec escape except exec execute false fetch first ' + 34 | 'float for force foreign forward free from full function global goto grant ' + 35 | 'group grouping having hour ignore index inner insensitive insert instead ' + 36 | 'int integer intersect into is isolation key last level load local max min ' + 37 | 'minute modify move name national nchar next no numeric of off on only ' + 38 | 'open option order out output partial password precision prepare primary ' + 39 | 'prior privileges procedure public read real references relative repeatable ' + 40 | 'restrict return returns revoke rollback rollup rows rule schema scroll ' + 41 | 'second section select sequence serializable set size smallint static ' + 42 | 'statistics table temp temporary then time timestamp to top transaction ' + 43 | 'translation trigger true truncate uncommitted union unique update values ' + 44 | 'varchar varying view when where with work'; 45 | 46 | var operators = 'all and any between cross in join like not null or outer some'; 47 | 48 | this.regexList = [ 49 | { regex: /--(.*)$/gm, css: 'comments' }, // one line and multiline comments 50 | { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings 51 | { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // single quoted strings 52 | { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'color2' }, // functions 53 | { regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such 54 | { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword 55 | ]; 56 | }; 57 | 58 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 59 | Brush.aliases = ['sql']; 60 | 61 | SyntaxHighlighter.brushes.Sql = Brush; 62 | 63 | // CommonJS 64 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 65 | })(); 66 | 67 | -------------------------------------------------------------------------------- /functions/find/find-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 43 | 44 | 45 | 46 | 47 |

Demo: Finding specific descendants of matched elements.

48 |

Run Demo View Code

49 |
50 | 51 |

52 |
    53 |
  • Folder 1 54 |
      55 |
    • Subfolder 1 56 |
        57 |
      • Item 1.1.1
      • 58 |
      59 |
    • 60 |
    • Subfolder 2 61 |
        62 |
      • Item 1.2.1
      • 63 |
          64 |
        • Item 1.2.1.1
        • 65 |
        • Item 1.2.1.2
        • 66 |
        67 |
      68 |
    • 69 |
    70 |
  • 71 |
  • Folder 2 72 |
      73 |
    • Item 1.3.1
    • 74 |
        75 |
      • Item 1.3.1.1
      • 76 |
      • Item 1.3.1.2
      • 77 |
      78 |
    79 |
  • 80 |
81 |
82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushPerl.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by David Simmons-Duffin and Marty Kube 25 | 26 | var funcs = 27 | 'abs accept alarm atan2 bind binmode chdir chmod chomp chop chown chr ' + 28 | 'chroot close closedir connect cos crypt defined delete each endgrent ' + 29 | 'endhostent endnetent endprotoent endpwent endservent eof exec exists ' + 30 | 'exp fcntl fileno flock fork format formline getc getgrent getgrgid ' + 31 | 'getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr ' + 32 | 'getnetbyname getnetent getpeername getpgrp getppid getpriority ' + 33 | 'getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid ' + 34 | 'getservbyname getservbyport getservent getsockname getsockopt glob ' + 35 | 'gmtime grep hex index int ioctl join keys kill lc lcfirst length link ' + 36 | 'listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd ' + 37 | 'oct open opendir ord pack pipe pop pos print printf prototype push ' + 38 | 'quotemeta rand read readdir readline readlink readpipe recv rename ' + 39 | 'reset reverse rewinddir rindex rmdir scalar seek seekdir select semctl ' + 40 | 'semget semop send setgrent sethostent setnetent setpgrp setpriority ' + 41 | 'setprotoent setpwent setservent setsockopt shift shmctl shmget shmread ' + 42 | 'shmwrite shutdown sin sleep socket socketpair sort splice split sprintf ' + 43 | 'sqrt srand stat study substr symlink syscall sysopen sysread sysseek ' + 44 | 'system syswrite tell telldir time times tr truncate uc ucfirst umask ' + 45 | 'undef unlink unpack unshift utime values vec wait waitpid warn write'; 46 | 47 | var keywords = 48 | 'bless caller continue dbmclose dbmopen die do dump else elsif eval exit ' + 49 | 'for foreach goto if import last local my next no our package redo ref ' + 50 | 'require return sub tie tied unless untie until use wantarray while'; 51 | 52 | this.regexList = [ 53 | { regex: new RegExp('#[^!].*$', 'gm'), css: 'comments' }, 54 | { regex: new RegExp('^\\s*#!.*$', 'gm'), css: 'preprocessor' }, // shebang 55 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, 56 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, 57 | { regex: new RegExp('(\\$|@|%)\\w+', 'g'), css: 'variable' }, 58 | { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, 59 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } 60 | ]; 61 | 62 | this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags); 63 | } 64 | 65 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 66 | Brush.aliases = ['perl', 'Perl', 'pl']; 67 | 68 | SyntaxHighlighter.brushes.Perl = Brush; 69 | 70 | // CommonJS 71 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 72 | })(); 73 | -------------------------------------------------------------------------------- /functions/serializearray/serializearray-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 49 | 50 | 60 | 61 | 62 | 63 | 64 |

To run the demo simply enter anything into the form and click "Run Demo" below in the examples.

65 | 66 |
67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 |
81 | 82 |

Demo 1: Create an array of all the form field values

83 |

Run Demo View Code

84 |
85 | 86 |

Demo 2: Create a url string with all the form field values

87 |

Run Demo View Code

88 |
89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /css/shThemeEclipse.css: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | .syntaxhighlighter { 18 | background-color: white !important; 19 | } 20 | .syntaxhighlighter .line.alt1 { 21 | background-color: white !important; 22 | } 23 | .syntaxhighlighter .line.alt2 { 24 | background-color: white !important; 25 | } 26 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { 27 | background-color: #c3defe !important; 28 | } 29 | .syntaxhighlighter .line.highlighted.number { 30 | color: white !important; 31 | } 32 | .syntaxhighlighter table caption { 33 | color: black !important; 34 | } 35 | .syntaxhighlighter .gutter { 36 | color: #787878 !important; 37 | } 38 | .syntaxhighlighter .gutter .line { 39 | border-right: 3px solid #d4d0c8 !important; 40 | } 41 | .syntaxhighlighter .gutter .line.highlighted { 42 | background-color: #d4d0c8 !important; 43 | color: white !important; 44 | } 45 | .syntaxhighlighter.printing .line .content { 46 | border: none !important; 47 | } 48 | .syntaxhighlighter.collapsed { 49 | overflow: visible !important; 50 | } 51 | .syntaxhighlighter.collapsed .toolbar { 52 | color: #3f5fbf !important; 53 | background: white !important; 54 | border: 1px solid #d4d0c8 !important; 55 | } 56 | .syntaxhighlighter.collapsed .toolbar a { 57 | color: #3f5fbf !important; 58 | } 59 | .syntaxhighlighter.collapsed .toolbar a:hover { 60 | color: #aa7700 !important; 61 | } 62 | .syntaxhighlighter .toolbar { 63 | color: #a0a0a0 !important; 64 | background: #d4d0c8 !important; 65 | border: none !important; 66 | } 67 | .syntaxhighlighter .toolbar a { 68 | color: #a0a0a0 !important; 69 | } 70 | .syntaxhighlighter .toolbar a:hover { 71 | color: red !important; 72 | } 73 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a { 74 | color: black !important; 75 | } 76 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a { 77 | color: #3f5fbf !important; 78 | } 79 | .syntaxhighlighter .string, .syntaxhighlighter .string a { 80 | color: #2a00ff !important; 81 | } 82 | .syntaxhighlighter .keyword { 83 | color: #7f0055 !important; 84 | } 85 | .syntaxhighlighter .preprocessor { 86 | color: #646464 !important; 87 | } 88 | .syntaxhighlighter .variable { 89 | color: #aa7700 !important; 90 | } 91 | .syntaxhighlighter .value { 92 | color: #009900 !important; 93 | } 94 | .syntaxhighlighter .functions { 95 | color: #ff1493 !important; 96 | } 97 | .syntaxhighlighter .constants { 98 | color: #0066cc !important; 99 | } 100 | .syntaxhighlighter .script { 101 | font-weight: bold !important; 102 | color: #7f0055 !important; 103 | background-color: none !important; 104 | } 105 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a { 106 | color: gray !important; 107 | } 108 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a { 109 | color: #ff1493 !important; 110 | } 111 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a { 112 | color: red !important; 113 | } 114 | 115 | .syntaxhighlighter .keyword { 116 | font-weight: bold !important; 117 | } 118 | .syntaxhighlighter .xml .keyword { 119 | color: #3f7f7f !important; 120 | font-weight: normal !important; 121 | } 122 | .syntaxhighlighter .xml .color1, .syntaxhighlighter .xml .color1 a { 123 | color: #7f007f !important; 124 | } 125 | .syntaxhighlighter .xml .string { 126 | font-style: italic !important; 127 | color: #2a00ff !important; 128 | } 129 | -------------------------------------------------------------------------------- /functions/filter/filter-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 66 | 67 | 73 | 74 | 75 | 76 | 77 |

Demo: Using filter to match sub elements.

78 |

In this example, .filter() is used to style paragraphs based on thier content.

79 |

Run Demo View Code

80 |
81 | 82 |

83 |

Paragraph 1

84 |

Paragraph 2 with 'span' tag

85 |

Paragraph 3 with 'strong' tag

86 |

Paragraph 4 with "highlight" class.

87 |

Paragraph 5 with 'span' tag

88 |

Paragraph 6

89 |

Paragraph 7 with 'strong' tag

90 |

Paragraph 8 with 'span' tag

91 |

Paragraph 9

92 |
93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /functions/ajax/ajax-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 78 | 79 | 80 | 81 | 82 |

Demo: Using $.ajax() to load content without reloading the entire page.

83 |

HTML content is held in separate files which are inserted below using AJAX. Note that it is also courtesy to show a loading image while the AJAX request is processing. Content 3 has a 2 second delay to simulate the loading image.

84 |

Run Demo View Code

85 |
86 |
Content will appear here.
87 |
88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushPowerShell.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributes by B.v.Zanten, Getronics 25 | // http://confluence.atlassian.com/display/CONFEXT/New+Code+Macro 26 | 27 | var keywords = 'Add-Content Add-History Add-Member Add-PSSnapin Clear(-Content)? Clear-Item ' + 28 | 'Clear-ItemProperty Clear-Variable Compare-Object ConvertFrom-SecureString Convert-Path ' + 29 | 'ConvertTo-Html ConvertTo-SecureString Copy(-Item)? Copy-ItemProperty Export-Alias ' + 30 | 'Export-Clixml Export-Console Export-Csv ForEach(-Object)? Format-Custom Format-List ' + 31 | 'Format-Table Format-Wide Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command ' + 32 | 'Get-Content Get-Credential Get-Culture Get-Date Get-EventLog Get-ExecutionPolicy ' + 33 | 'Get-Help Get-History Get-Host Get-Item Get-ItemProperty Get-Location Get-Member ' + 34 | 'Get-PfxCertificate Get-Process Get-PSDrive Get-PSProvider Get-PSSnapin Get-Service ' + 35 | 'Get-TraceSource Get-UICulture Get-Unique Get-Variable Get-WmiObject Group-Object ' + 36 | 'Import-Alias Import-Clixml Import-Csv Invoke-Expression Invoke-History Invoke-Item ' + 37 | 'Join-Path Measure-Command Measure-Object Move(-Item)? Move-ItemProperty New-Alias ' + 38 | 'New-Item New-ItemProperty New-Object New-PSDrive New-Service New-TimeSpan ' + 39 | 'New-Variable Out-Default Out-File Out-Host Out-Null Out-Printer Out-String Pop-Location ' + 40 | 'Push-Location Read-Host Remove-Item Remove-ItemProperty Remove-PSDrive Remove-PSSnapin ' + 41 | 'Remove-Variable Rename-Item Rename-ItemProperty Resolve-Path Restart-Service Resume-Service ' + 42 | 'Select-Object Select-String Set-Acl Set-Alias Set-AuthenticodeSignature Set-Content ' + 43 | 'Set-Date Set-ExecutionPolicy Set-Item Set-ItemProperty Set-Location Set-PSDebug ' + 44 | 'Set-Service Set-TraceSource Set(-Variable)? Sort-Object Split-Path Start-Service ' + 45 | 'Start-Sleep Start-Transcript Stop-Process Stop-Service Stop-Transcript Suspend-Service ' + 46 | 'Tee-Object Test-Path Trace-Command Update-FormatData Update-TypeData Where(-Object)? ' + 47 | 'Write-Debug Write-Error Write(-Host)? Write-Output Write-Progress Write-Verbose Write-Warning'; 48 | var alias = 'ac asnp clc cli clp clv cpi cpp cvpa diff epal epcsv fc fl ' + 49 | 'ft fw gal gc gci gcm gdr ghy gi gl gm gp gps group gsv ' + 50 | 'gsnp gu gv gwmi iex ihy ii ipal ipcsv mi mp nal ndr ni nv oh rdr ' + 51 | 'ri rni rnp rp rsnp rv rvpa sal sasv sc select si sl sleep sort sp ' + 52 | 'spps spsv sv tee cat cd cp h history kill lp ls ' + 53 | 'mount mv popd ps pushd pwd r rm rmdir echo cls chdir del dir ' + 54 | 'erase rd ren type % \\?'; 55 | 56 | this.regexList = [ 57 | { regex: /#.*$/gm, css: 'comments' }, // one line comments 58 | { regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // variables $Computer1 59 | { regex: /\-[a-zA-Z]+\b/g, css: 'keyword' }, // Operators -not -and -eq 60 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 61 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 62 | { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' }, 63 | { regex: new RegExp(this.getKeywords(alias), 'gmi'), css: 'keyword' } 64 | ]; 65 | }; 66 | 67 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 68 | Brush.aliases = ['powershell', 'ps']; 69 | 70 | SyntaxHighlighter.brushes.PowerShell = Brush; 71 | 72 | // CommonJS 73 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 74 | })(); 75 | -------------------------------------------------------------------------------- /functions/setinterval/setinterval-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 85 | 86 | 92 | 93 | 94 | 95 | 96 |

Demo 1: Simple time counter.

97 |

Click "Run Demo" to start the timer and click "Reset" to stop the timer.

98 |

Run Demo View Code

99 |
0 seconds elapsed.
100 | 101 |

Demo 2: Digital time display.

102 |

Run Demo View Code

103 |
104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /functions/animate/animate-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 81 | 82 | 83 | 84 | 85 |

Demo 1: Animate text

86 |

You can easily animate the size of text.

87 |

Run Demo View Code

88 |
89 | 90 |

Demo 2: Animate size

91 |

You can easily animate the size of a div.

92 |

Run Demo View Code

93 |
jquery books
94 | 95 |

Demo 3: Animate movement

96 |

JQuery's .animate() function is ansyncronous so multiple animations can run at the same time. You can also use the .stop() function to stop the animation.

97 |

Run Demo View Code

98 |
99 | jquery car 1
100 | jquery car 2
101 | jquery car 3
102 | jquery car 4
103 | jquery car 5
104 |
105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /functions/stopimmediatepropagation/stopimmediatepropagation-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 74 | 75 | 76 | 77 | 78 |

Demo: Preventing all future bound events from firing.

79 |

Run Demo View Code

80 |
81 | This div doesn't use the .stopImmediatePropagation() function. 82 |
83 | Link 1: http://www.jquery4u.com
84 | Link 2: http://www.jquery4u.com
85 | Link 3: http://www.jquery4u.com
86 |

87 | This div does use the .stopImmediatePropagation() function. 88 |
89 | Link 1: http://www.jquery4u.com
90 | Link 2: http://www.jquery4u.com
91 | Link 3: http://www.jquery4u.com
92 |
93 |

As you can see when you click the links in the top div all events fire off. But when you click the links in the bottom div only the code for all links fires off as is calls .stopImmediatePropagation() on the event. It is also worth noting this function also prevents the event from happening on any ancestor elements just like the .stopPropagation() function as seen in the example where the div 'click' event doesn't fire on the bottom links.

94 |
95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /js/function-demos-script.js: -------------------------------------------------------------------------------- 1 | /* Copyright jQuery4u.com - Script for hooking up 50 function demo buttons and displaying code. */ 2 | var JQ4UFUNCS = 3 | { 4 | init: function() 5 | { 6 | _this = this; 7 | //console.log('running init...'); 8 | 9 | /* settings */ 10 | var fns = ['animate1','animate2','animate3','setinterval1','setinterval2','settimeout','slidetoggle','fadetoggle','delay','css1','css2','addclass','toggleclass','html','append','clone','ajax','getjson','getscript','load','jsonp','bind1','bind2','bind3','live','delegate','preventdefault','stoppropagation','stopimmediatepropagation','each1','each2','data','match1','match2','find','filter','slice','next','extend1','extend2','serializearray1','serializearray2']; /* array of demo functions */ 11 | $('.demoarea').hide(); /* demos shown when user clicks run */ 12 | 13 | /* ------------------------------ Demo Button Events ------------------------ */ 14 | $('.demobtn').live('click', function(e) { 15 | e.preventDefault(); 16 | var _id = _this.getId($(this)); 17 | $(_id).show(); /* show demoarea */ 18 | $(_id+'-resetbtn').show(); /* show reset button */ 19 | }); 20 | 21 | /* I've coded the function this way ONLY because originally I was using eval() but IE poop'd - IE sucks. */ 22 | $.getScript('http://www.jquery4u.com/scripts/htmlentities.js', function() 23 | { 24 | $('.demobtn, .codebtn, .resetbtn').live('click', function(e) { e.preventDefault(); }); 25 | $.each(fns, function(i,fn) 26 | { 27 | /* check for presence of function */ 28 | var parentPresence = $('#maindemoarea').html() == null ? false : true; 29 | var fnPresence = parentPresence == true ? ($('#maindemoarea').html().indexOf('id="'+fn+'"') !== -1) : ($('body').html().indexOf('id="'+fn+'"') !== -1); 30 | if(fnPresence) 31 | { 32 | $('#'+fn+'-demobtn').live('click', function(e) { JQFUNCS.runFunc[fn]["run"](fn); }); 33 | $('#'+fn+'-codebtn').live('click', function(e) { $('#'+fn+'-sourcecode').fadeToggle('slow'); }); 34 | $('#'+fn+'-resetbtn').live('click', function(e) { JQFUNCS.runFunc[fn]["reset"](fn); }); 35 | 36 | /* --------------------- Attach the source code to demo ------------------------------ */ 37 | var functionCodeRun = JQFUNCS.runFunc[fn]["run"].toString(); 38 | functionCodeRun = new String(functionCodeRun.substring(functionCodeRun.indexOf('{')+1,functionCodeRun.lastIndexOf('}')).trim()); 39 | var functionCodeReset = JQFUNCS.runFunc[fn]["reset"].toString(); 40 | functionCodeReset = new String(functionCodeReset.substring(functionCodeReset.indexOf('{')+1,functionCodeReset.lastIndexOf('}')).trim()); 41 | $('#'+fn).after('
'+'

Code to Run

'+'
'+htmlentities(functionCodeRun)+'
'+'

Code to Reset

'+'
'+htmlentities(functionCodeReset)+'
'+'
').next().hide(); 42 | /* remove empty reset codes */ 43 | if (!$('#'+fn+'-raw-resetcode').html()) { $('#'+fn+'-raw-resetcode').remove(); $('#'+fn+'-resetcontainer').remove(); } 44 | } 45 | }); 46 | }); 47 | }, 48 | 49 | /* helper function to strip the main id for the demo */ 50 | getId: function(elem) 51 | { 52 | var thisId = elem.attr('id'); 53 | thisId = thisId.substring(0,thisId.lastIndexOf('-')); 54 | return '#' + thisId; 55 | } 56 | } 57 | 58 | /* ------------------------------ Nav Buttons Scroll+Highlight Sections ------------------------------ */ 59 | $("#view-demo-btn").bind('click', function(e) 60 | { 61 | e.preventDefault(); 62 | var destination = $($(this).attr("href")).offset().top; 63 | $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1100 ); 64 | $('.exposedemo').css('z-index','99999').after('
'); 65 | $('#overlay').fadeIn(300); 66 | }); 67 | 68 | $("#view-code-btn").bind('click', function(e) 69 | { 70 | e.preventDefault(); 71 | var destination = $($(this).attr("href")).offset().top; 72 | $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1100 ); 73 | $('.exposecode').css('z-index','99999').after('
'); 74 | $('#overlay').fadeIn(300); 75 | }); 76 | 77 | $("#view-download-btn").bind('click', function(e) 78 | { 79 | e.preventDefault(); 80 | var destination = $($(this).attr("href")).offset().top; 81 | $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1100 ); 82 | $('.exposedownload').css('z-index','99999').after('
'); 83 | $('#overlay').fadeIn(300); 84 | }); 85 | 86 | $('#overlay').live('click', function(e) 87 | { 88 | $(this).fadeOut(300, function(){ 89 | $('.expose').css('z-index','1'); 90 | }); 91 | }); 92 | 93 | jQuery(document).ready( function () 94 | { 95 | JQ4UFUNCS.init(); /* setup event handlers and code display */ 96 | }); -------------------------------------------------------------------------------- /404page.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 404 Function Not Found 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 |
30 |
31 | JQUERY4U FUNCTION DEMOS 32 | 37 | 38 | 41 |
42 |
43 |
44 | 45 |
46 | 102 |
103 | 104 | 105 |
106 |

Function Not Found

107 |
108 | 109 | 110 | 111 |
112 | 113 | 114 |
115 |

116 |

The Clueless Coding Monkey!

117 |
118 | 119 |
120 | 121 | 122 |
123 |

© JQUERY4U 2011

124 |
125 |
126 |
127 | 128 | 129 | -------------------------------------------------------------------------------- /functions/bind/bind-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 86 | 87 | 94 | 95 | 96 | 97 | 98 |

Demo 1: Event when user clicks or hovers a div.

99 |

Run Demo View Code

100 |
101 |
102 |
103 | 104 |

Demo 2: Event when mouse hovers or double clicks a div.

105 |

Press "Run Demo" a few times in a row for some nice effects. Also you can double click the boxes to make the disappear!

106 |

Run Demo View Code

107 |
108 | 109 |

Demo 3: Event a user presses a keyboard key.

110 |

Press any keyboard key that is in the boxes below.

111 |

Run Demo View Code

112 |
113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushPhp.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var funcs = 'abs acos acosh addcslashes addslashes ' + 25 | 'array_change_key_case array_chunk array_combine array_count_values array_diff '+ 26 | 'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+ 27 | 'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+ 28 | 'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+ 29 | 'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+ 30 | 'array_push array_rand array_reduce array_reverse array_search array_shift '+ 31 | 'array_slice array_splice array_sum array_udiff array_udiff_assoc '+ 32 | 'array_udiff_uassoc array_uintersect array_uintersect_assoc '+ 33 | 'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+ 34 | 'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+ 35 | 'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+ 36 | 'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+ 37 | 'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+ 38 | 'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+ 39 | 'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+ 40 | 'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+ 41 | 'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+ 42 | 'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+ 43 | 'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+ 44 | 'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+ 45 | 'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+ 46 | 'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+ 47 | 'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+ 48 | 'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+ 49 | 'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+ 50 | 'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+ 51 | 'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+ 52 | 'parse_ini_file parse_str parse_url passthru pathinfo print readlink realpath rewind rewinddir rmdir '+ 53 | 'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+ 54 | 'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+ 55 | 'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+ 56 | 'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+ 57 | 'strtoupper strtr strval substr substr_compare'; 58 | 59 | var keywords = 'abstract and array as break case catch cfunction class clone const continue declare default die do ' + 60 | 'else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach ' + 61 | 'function include include_once global goto if implements interface instanceof namespace new ' + 62 | 'old_function or private protected public return require require_once static switch ' + 63 | 'throw try use var while xor '; 64 | 65 | var constants = '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__'; 66 | 67 | this.regexList = [ 68 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 69 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 70 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 71 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 72 | { regex: /\$\w+/g, css: 'variable' }, // variables 73 | { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // common functions 74 | { regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' }, // constants 75 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keyword 76 | ]; 77 | 78 | this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags); 79 | }; 80 | 81 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 82 | Brush.aliases = ['php']; 83 | 84 | SyntaxHighlighter.brushes.Php = Brush; 85 | 86 | // CommonJS 87 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 88 | })(); 89 | -------------------------------------------------------------------------------- /js/syntaxhighlighter/shBrushCpp.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Copyright 2006 Shin, YoungJin 25 | 26 | var datatypes = 'ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR ' + 27 | 'DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH ' + 28 | 'HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP ' + 29 | 'HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY ' + 30 | 'HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT ' + 31 | 'HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE ' + 32 | 'LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF ' + 33 | 'LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR ' + 34 | 'LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR ' + 35 | 'PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT ' + 36 | 'PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 ' + 37 | 'POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR ' + 38 | 'PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 ' + 39 | 'PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT ' + 40 | 'SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG ' + 41 | 'ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM ' + 42 | 'char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t ' + 43 | 'clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS ' + 44 | 'FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t ' + 45 | '__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t ' + 46 | 'jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler ' + 47 | 'sig_atomic_t size_t _stat __stat64 _stati64 terminate_function ' + 48 | 'time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf ' + 49 | 'va_list wchar_t wctrans_t wctype_t wint_t signed'; 50 | 51 | var keywords = 'break case catch class const __finally __exception __try ' + 52 | 'const_cast continue private public protected __declspec ' + 53 | 'default delete deprecated dllexport dllimport do dynamic_cast ' + 54 | 'else enum explicit extern if for friend goto inline ' + 55 | 'mutable naked namespace new noinline noreturn nothrow ' + 56 | 'register reinterpret_cast return selectany ' + 57 | 'sizeof static static_cast struct switch template this ' + 58 | 'thread throw true false try typedef typeid typename union ' + 59 | 'using uuid virtual void volatile whcar_t while'; 60 | 61 | var functions = 'assert isalnum isalpha iscntrl isdigit isgraph islower isprint' + 62 | 'ispunct isspace isupper isxdigit tolower toupper errno localeconv ' + 63 | 'setlocale acos asin atan atan2 ceil cos cosh exp fabs floor fmod ' + 64 | 'frexp ldexp log log10 modf pow sin sinh sqrt tan tanh jmp_buf ' + 65 | 'longjmp setjmp raise signal sig_atomic_t va_arg va_end va_start ' + 66 | 'clearerr fclose feof ferror fflush fgetc fgetpos fgets fopen ' + 67 | 'fprintf fputc fputs fread freopen fscanf fseek fsetpos ftell ' + 68 | 'fwrite getc getchar gets perror printf putc putchar puts remove ' + 69 | 'rename rewind scanf setbuf setvbuf sprintf sscanf tmpfile tmpnam ' + 70 | 'ungetc vfprintf vprintf vsprintf abort abs atexit atof atoi atol ' + 71 | 'bsearch calloc div exit free getenv labs ldiv malloc mblen mbstowcs ' + 72 | 'mbtowc qsort rand realloc srand strtod strtol strtoul system ' + 73 | 'wcstombs wctomb memchr memcmp memcpy memmove memset strcat strchr ' + 74 | 'strcmp strcoll strcpy strcspn strerror strlen strncat strncmp ' + 75 | 'strncpy strpbrk strrchr strspn strstr strtok strxfrm asctime ' + 76 | 'clock ctime difftime gmtime localtime mktime strftime time'; 77 | 78 | this.regexList = [ 79 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 80 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 81 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 82 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 83 | { regex: /^ *#.*/gm, css: 'preprocessor' }, 84 | { regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'color1 bold' }, 85 | { regex: new RegExp(this.getKeywords(functions), 'gm'), css: 'functions bold' }, 86 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword bold' } 87 | ]; 88 | }; 89 | 90 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 91 | Brush.aliases = ['cpp', 'c']; 92 | 93 | SyntaxHighlighter.brushes.Cpp = Brush; 94 | 95 | // CommonJS 96 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 97 | })(); 98 | -------------------------------------------------------------------------------- /functions/match/match-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jQuery Function Demo - jQuery4u.com 5 | 6 | 7 | 8 | 9 | 74 | 75 | 82 | 83 | 84 | 85 | 86 |

Demo 1: Extract email addresses from inside HTML (string).

87 |

We can use .test() to check if there are any emails present and .match() to extract them.

88 |

Run Demo View Code

89 |

Curabitur placerat commodo augue eget congue. Aliquam id ante leo. Duis at libero magna, at dignissim odio. Aliquam aliquet suscipit mollis. Pellentesque libero tortor, elementum id mattis vel, mattis eget metus. sombody1@somewhere.com Nam convallis interdum imperdiet. Fusce at magna tellus. Sed mi ante, aliquam at accumsan ac, tristique sit amet dui. Aliquam eleifend molestie ligula. Vivamus eleifend, sombody2@somewhere.com diam id tincidunt posuere, ipsum dui elementum sapien, posuere pulvinar risus neque id turpis. Nullam volutpat cursus libero, sit amet euismod justo eleifend vitae.

90 | 91 |
92 | 93 |

Demo 2: Using jQuery :contains() selector to match elements with substrings.

94 |

We can use the case sensitive :contains() selector to match substrings inside any of that element's descendants. Remember it is case sensitive and will match the entire element.

95 |

Run Demo View Code

96 |
97 |
    98 |
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  • 99 |
  • Curabitur quis arcu ac justo pellentesque ullamcorper sit amet quis mi.
  • 100 |
  • Nam a lorem quis lacus dapibus egestas et a ipsum.
  • 101 |
  • Phasellus nec magna quis diam cursus egestas quis aliquet tortor.
  • 102 |
  • Ut feugiat vestibulum mi, sit amet consequat orci facilisis ac.
  • 103 |
  • Phasellus et enim ut sem dapibus hendrerit.
  • 104 |
105 | Search: 106 |
107 | 108 | 109 | 110 | --------------------------------------------------------------------------------