SHOW:
|
|
- or go back to the newest paste.
| 1 | - | <a class="ajax" rel="showGallery" href="photo/gallery/1">Gallery 1</a></li> |
| 1 | + | <a class="ajax" rel="showGallery" href="photo/gallery/1">Gallery 1</a> |
| 2 | - | <a class="ajax" rel="showGallery" href="photo/gallery/2">Gallery 2</a></li> |
| 2 | + | <a class="ajax" rel="showGallery" href="photo/gallery/2">Gallery 2</a> |
| 3 | ||
| 4 | <script> | |
| 5 | $( function() {
| |
| 6 | $( 'a.ajax' ).live( 'click', function() {
| |
| 7 | var href = $( this ).attr( 'href' ); | |
| 8 | var drawFunc = $( this ).attr( 'rel' ); | |
| 9 | ||
| 10 | $.get( | |
| 11 | href, | |
| 12 | {},
| |
| 13 | function( data ) {
| |
| 14 | draw( drawFunc, data ); | |
| 15 | // Save in stack | |
| 16 | }, | |
| 17 | 'json' | |
| 18 | ); | |
| 19 | ||
| 20 | return false; | |
| 21 | }); | |
| 22 | }); | |
| 23 | ||
| 24 | function draw( drawFunc, data ) | |
| 25 | {
| |
| 26 | // Spec effects | |
| 27 | drawFunc( data ); | |
| 28 | // Spec effects | |
| 29 | } | |
| 30 | ||
| 31 | function showGallery( data ) | |
| 32 | {
| |
| 33 | // Draw gallery | |
| 34 | } | |
| 35 | </script> |