Advertisement
Guest User

Untitled

a guest
Dec 24th, 2010
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function() {
  2.  
  3.     //
  4.     //  Thumbnails
  5.     //
  6.  
  7.     $("img.thumbs").hide();                                
  8.     $("img.thumbs").delay(500).fadeIn("slow");             
  9.  
  10.     $("img.thumbs").click(function()                             
  11.     {
  12.         var imgLink = $(this).attr("src");                 
  13.         $("img#spotlight").attr("src", imgLink);           
  14.        
  15.     });
  16.  
  17.     //
  18.     //  Page Initialization
  19.     //
  20.        
  21.     $.ajax({
  22.             type : 'POST',
  23.             url  : 'next.php',
  24.             dataType : 'json',
  25.             data        : { nextID : $("a#next").attr("rel") },
  26.             success  : function ( data ) {
  27.  
  28.                       var lastID = $("a#next").attr("rel");
  29.                       var originID = $("a#next").attr("rev");
  30.                      
  31.                       if(lastID == 1) lastID = originID; else lastID--;
  32.                      
  33.                       $("img#spotlight").attr("src",data.spotlightimage);
  34.                       $("div#showcase h1").text(data.title);
  35.                       $("div#showcase h2").text(data.subtitle);
  36.                       $("div#showcase p").text(data.description);
  37.                       $("a#next").attr("rel", lastID);
  38.              
  39.                       $("ul.features li").remove();
  40.              
  41.                       $.each(data.features, function(k,v){
  42.                               var li = '<li>' + v + '</li>';
  43.                               $("ul.features").append(li);
  44.                       });
  45.  
  46.                       $("div.thumbnails li").remove();
  47.  
  48.                       $.each(data.images, function(k,v){
  49.                               var imgli = '<li>' + v + '</li>';
  50.                               $("div.thumbnails ul").append(imgli);
  51.                       });
  52.              
  53.             },
  54.             error    : function ( XMLHttpRequest, textStatus, errorThrown) {
  55.                          $("div#showcase h1").text("An error has occured: " + errorThrown);
  56.             }
  57.     });            
  58.  
  59.     //
  60.     // Next Link
  61.     //
  62.    
  63.     $("a#next").click(function()
  64.     {
  65.         $.ajax({
  66.                type : 'POST',
  67.                url  : 'next.php',
  68.                dataType : 'json',
  69.                data     : { nextID : $("a#next").attr("rel") },
  70.                success  : function ( data ) {
  71.  
  72.                           var lastID = $("a#next").attr("rel");
  73.                           var originID = $("a#next").attr("rev");
  74.                          
  75.                           if(lastID == 1) lastID = originID; else lastID--;
  76.                          
  77.                           $("img#spotlight").attr("src",data.spotlightimage);
  78.                           $("div#showcase h1").text(data.title);
  79.                           $("div#showcase h2").text(data.subtitle);
  80.                           $("div#showcase p").text(data.description);
  81.                           $("a#next").attr("rel", lastID);
  82.                  
  83.                           $("ul.features li").remove();
  84.                  
  85.                           $.each(data.features, function(k,v){
  86.                                  var li = '<li>' + v + '</li>';
  87.                           $("ul.features").append(li);
  88.                     });
  89.    
  90.                           $("div.thumbnails li").remove();
  91.    
  92.                           $.each(data.images, function(k,v){
  93.                                   var imgli = '<li>' + v + '</li>';
  94.                                   $("div.thumbnails ul").append(imgli);
  95.                           });
  96.                  
  97.                },
  98.                error    : function ( XMLHttpRequest, textStatus, errorThrown) {
  99.                          $("div#showcase h1").text("An error has occured: " + errorThrown);
  100.                }
  101.         });            
  102.        
  103.     });                        
  104.    
  105. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement