Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <a class="ajax" rel="showGallery" href="photo/gallery/1">Gallery 1</a></li>
- <a class="ajax" rel="showGallery" href="photo/gallery/2">Gallery 2</a></li>
- <script>
- $( function() {
- $( 'a.ajax' ).live( 'click', function() {
- var href = $( this ).attr( 'href' );
- var drawFunc = $( this ).attr( 'rel' );
- $.get(
- href,
- {},
- function( data ) {
- draw( drawFunc, data );
- // Save in stack
- },
- 'json'
- );
- return false;
- });
- });
- function draw( drawFunc, data )
- {
- // Spec effects
- drawFunc( data );
- // Spec effects
- }
- function showGallery( data )
- {
- // Draw gallery
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment