Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- //
- // Thumbnails
- //
- $("img.thumbs").hide();
- $("img.thumbs").delay(500).fadeIn("slow");
- $("img.thumbs").click(function()
- {
- var imgLink = $(this).attr("src");
- $("img#spotlight").attr("src", imgLink);
- });
- //
- // Page Initialization
- //
- $.ajax({
- type : 'POST',
- url : 'next.php',
- dataType : 'json',
- data : { nextID : $("a#next").attr("rel") },
- success : function ( data ) {
- var lastID = $("a#next").attr("rel");
- var originID = $("a#next").attr("rev");
- if(lastID == 1) lastID = originID; else lastID--;
- $("img#spotlight").attr("src",data.spotlightimage);
- $("div#showcase h1").text(data.title);
- $("div#showcase h2").text(data.subtitle);
- $("div#showcase p").text(data.description);
- $("a#next").attr("rel", lastID);
- $("ul.features li").remove();
- $.each(data.features, function(k,v){
- var li = '<li>' + v + '</li>';
- $("ul.features").append(li);
- });
- $("div.thumbnails li").remove();
- $.each(data.images, function(k,v){
- var imgli = '<li>' + v + '</li>';
- $("div.thumbnails ul").append(imgli);
- });
- },
- error : function ( XMLHttpRequest, textStatus, errorThrown) {
- $("div#showcase h1").text("An error has occured: " + errorThrown);
- }
- });
- //
- // Next Link
- //
- $("a#next").click(function()
- {
- $.ajax({
- type : 'POST',
- url : 'next.php',
- dataType : 'json',
- data : { nextID : $("a#next").attr("rel") },
- success : function ( data ) {
- var lastID = $("a#next").attr("rel");
- var originID = $("a#next").attr("rev");
- if(lastID == 1) lastID = originID; else lastID--;
- $("img#spotlight").attr("src",data.spotlightimage);
- $("div#showcase h1").text(data.title);
- $("div#showcase h2").text(data.subtitle);
- $("div#showcase p").text(data.description);
- $("a#next").attr("rel", lastID);
- $("ul.features li").remove();
- $.each(data.features, function(k,v){
- var li = '<li>' + v + '</li>';
- $("ul.features").append(li);
- });
- $("div.thumbnails li").remove();
- $.each(data.images, function(k,v){
- var imgli = '<li>' + v + '</li>';
- $("div.thumbnails ul").append(imgli);
- });
- },
- error : function ( XMLHttpRequest, textStatus, errorThrown) {
- $("div#showcase h1").text("An error has occured: " + errorThrown);
- }
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement