Profile

Achievement

first submission:submitting first snipplet popular snippet:having a snipplet with 20 favorites

1man's Recent Snippets



« Prev 1 2 3 4
Rather that using $(element).trigger('click'), check to see if execute has come from an element rather than directly.
0 1236 posted 13 years ago by 1man
Very useful snippet to link elements together.
0 1206 posted 13 years ago by 1man
Using an object as a simple switch.
0 1077 posted 13 years ago by 1man
Useful bit of CSS to vertically centre a navigation. Good for Pagination.
1 1154 posted 14 years ago by 1man
Useful snippet i found on a forum, use it to check to see if a user is old enough to submit a form.
2 1420 posted 14 years ago by 1man
Simple illustration of structuring your JavaScript and minimising your use of global vars.
0 1095 posted 14 years ago by 1man
An example taken from JavaScript: The good parts showing how to catch an exception.
0 1044 posted 14 years ago by 1man
Handy little snippet i found in 'jquery enlightenment' for caching certain selected files. Could be useful for larger files later on in a site.
1 1382 posted 15 years ago by 1man
Simple plugin to demonstrate how the 'this' keyword is used. Plugin also allows chaining via the 'return'
0 1243 posted 15 years ago by 1man
Example in 'jQuery enlightenment' Simple way to jump smoothly down the page without the use of a plugin.
3 1147 posted 15 years ago by 1man
Example given in the book jQuery Enlightenment. Create your own custom selectors in jQuery and manipulate as usual.
0 1061 posted 15 years ago by 1man
Very simple example of pulling in a JSON feed from Yahoo pipes using jQuery.
0 1361 posted 15 years ago by 1man
A way to time how long it takes to get through a certain block of code. Good way to measure performance on the page. You could also use the built in logging functions in firebug. Not sure how they would tally up in a test.
1 1178 posted 15 years ago by 1man
Quick little clientside script to pick out every 3rd image and add a class of last to it. I needed this because the images were layed out in 3 columns, adding a margin to the right hand side would leave a large gap on the right hand side which i d...
0 1241 posted 15 years ago by 1man
Adds a class of hasJS to the html element, can be used for CSS styling.
1 1172 posted 15 years ago by 1man
Finally got round going through a sliding door example myself. All fairly straightforward apart from a few IE6 issues (who would have guessed!). The button is floated so you may need to add overflow: hidden to it's container.
1 1092 posted 15 years ago by 1man
Useful little spippet for a button anchor where the text may change.
0 1170 posted 15 years ago by 1man
Great little snippit to add a <tr> to the bottom of a table. Note the use of the context in the jQuery e.g var n = $('tr:last td', this).length; Will have to use this in the future, very good to know!
4 1858 posted 16 years ago by 1man
Simple markup example in YAML.
0 1034 posted 16 years ago by 1man
A very simple plug-in I wrote to make x number of columns equal height. Looks for the column with the biggest height then sets the rest to the same. I'm sure it can be made cleaner, will look into that later.
4 1238 posted 16 years ago by 1man
Adding a namespace to an event can make it easier to unbind. It is very easy to unbind all events with the same namespace.
1 1078 posted 16 years ago by 1man
Never used the index() method in jQuery but could be useful to know. Find a selected elements index when you click on it. Note the $('ul#mylist') inside the index method, gives the search some context of where to look for .selected, saves looking thr...
1 1068 posted 16 years ago by 1man
Simple imagefader to rotate around a few images. Seem to be doing this a lot in various projects so decided to put something a bit more generic together. Uses jQuery. Images named as car1.jpg, car2.jpg, car3..... etc.
3 1204 posted 16 years ago by 1man
Very simple snippet to include if you want to auto update the year in a page copyright using PHP.
6 1232 posted 16 years ago by 1man
This is the custom layout template i use for the CleanCSS website, very handy!
0 1043 posted 16 years ago by 1man
Removed a certain word from a list of links (purely for design reasons). Link length way to long with the link included.
1 1445 posted 16 years ago by 1man
Click on an input field with a prefilled value, if that value equals the default then select it, if not leave it as it was. Relies on jQuery.
2 1596 posted 16 years ago by 1man
Simple PHP tutorial on how to use isset.
0 1548 posted 16 years ago by 1man
Using JSON-P with jQuery. Note the callback.
0 1045 posted 16 years ago by 1man
Should also work in IE6 because of the filter
5 1126 posted 16 years ago by 1man
« Prev 1 2 3 4