// JavaScript Document $(function() { var largePath = $("#thumbs li:eq(0) a").attr("href"); var desc =$("#thumbs li:eq(0) a").attr("rel"); var titlem =$("#thumbs li:eq(0) a").find("img").attr("title"); $('#urun h2').html(titlem); $('#urun p').html(desc); ramazan(largePath); $("#thumbs li a").addClass("hehe"); $("#thumbs li a").bind("click",hebele); $("#thumbs li:eq(0) a").unbind("click",hebele); $("#thumbs li a").click( function(){ return false; } ); }); function hebele() { $("#thumbs li a").unbind("click",hebele); $("#thumbs li a").addClass("hehe"); $(this).removeClass("hehe"); var largePath = $(this).attr("href"); var desc = $(this).attr("rel"); var titlem = $(this).find("img").attr("title"); $(".resim").find("img").fadeOut("fast", function () { $(".resim").find("img").attr('src',largePath).load ( function() { $(this).hide(); $(this).fadeIn("fast", function () { $(".resim").removeClass("loading"); $(".hehe").bind("click",hebele); } ); } ); } ).end().addClass("loading"); $('#urun h2').html(titlem); $('#urun p').html(desc); }; function ramazan(largePath) { $(".resim").empty(); var img = new Image(); // wrap our new image in jQuery, then: $(img) // once the image has loaded, execute this code .load(function () { // set the image hidden by default $(this).hide(); // with the holding div #loader, apply: $('.resim') // remove the loading class (so no background spinner), .removeClass('loading') // then insert our image .append(this); // fade our image in to create a nice effect $(this).fadeIn(); }) // if there was an error loading the image, react accordingly .error(function () { // notify the user that the image could not be loaded }) // *finally*, set the src attribute of the new image to our image .attr('src',largePath); };