benatkin / jquery-stuff
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
fc86b3c
jquery-stuff / convenience.html
| 11677322 » | benatkin | 2009-06-23 | 1 | <html> | |
| 2 | <head> | ||||
| 3 | <title>convenience</title> | ||||
| 4 | <script type="text/javascript" src="jquery.js"></script> | ||||
| 5 | <script type="text/javascript" src="jquery.convenience.js"></script> | ||||
| 6 | <script type="text/javascript"> | ||||
| 7 | $(function() { | ||||
| 8 | $.each(['red', 'green'], function() { | ||||
| 9 | var btn = $('<input>').attr({type: 'button', value: 'Frobnicate This!'}).addClass('frob'); | ||||
| 10 | $('<div>').addClass(this).css({backgroundColor: this}).appendTo($('body')).append(btn); | ||||
| 11 | }); | ||||
| 12 | $('div').css({width: '200px', height: '200px', padding: '20px', 'float': 'left'}); | ||||
| 13 | |||||
| 14 | $.convenience('frobnicate'); | ||||
| 15 | $('.green').frobnicate(function() { | ||||
| fc86b3c1 » | benatkin | 2009-06-23 | 16 | if (console) console.log('frobbed!'); | |
| 11677322 » | benatkin | 2009-06-23 | 17 | $(this).css({border: '5px solid black'}); | |
| 18 | }); | ||||
| 19 | $('.frob').click(function() { | ||||
| fc86b3c1 » | benatkin | 2009-06-23 | 20 | if (console) console.log('clicked!'); | |
| 11677322 » | benatkin | 2009-06-23 | 21 | $(this).frobnicate(); | |
| 22 | }); | ||||
| 23 | }); | ||||
| 24 | </script> | ||||
| 25 | </head> | ||||
| 26 | <body> | ||||
| 27 | </body> | ||||
| 28 | </html> | ||||
| 29 | |||||
