OK guys, my website is almost finished - http://www.visualise.ca/
But there is one thing that really bugs me. When I click on a thumbnail to open a post which loads within the same page using AJAX and then click on another thumbnail to load another post the transition is not smooth and the image takes a while to load and it's ugly. Is there a way I can improve that and make everything smooth using fadeIn/fadeOut ?
Here is what I tried with no luck (active now).
$(".ajaxed").live("开发者_如何学JAVAclick", function(event) {
$.address.crawlable(true).value($(this).attr("rel"));
$("#content").fadeTo(500,0);
$("html,body").animate({scrollTop: 205}, 300);
var post_slug = $(this).attr("rel");
$("#board").load("ajax/",{slug:post_slug});
$("#board").delay(1500).slideDown("slow");
return false;
});
Many thanks for your time and help
Try this
$(".ajaxed").live("click", function(event) {
var post_slug = $(this).attr("rel");
$.address.crawlable(true).value(post_slug );
$("#content").fadeTo(500,0);
$("html,body").animate({scrollTop: 205}, 300);
$("#board").stop().load("ajax/",{slug:post_slug}, function(){
$(this).slideDown("slow")
});
return false;
});
Here is the code I end up using.
$(".navig a").live("click", function(event) {
var post_slug = $(this)[0].pathname.substring(1);
var board_h = $("#board").height();
$.address.crawlable(true).value(post_slug).strict(true);
$("#board-wrapper").css('height', board_h + 'px');
$("#board").fadeOut('slow', function(){
$("#board").stop().load("ajax/",{slug:post_slug}, function(){
$("#board").delay(1000).fadeIn('slow', function(){
var board_h2 = $("#board").height();
$("#board-wrapper").css('height', board_h2 + 'px');
});
});
});
return false;
});
Just to let people know.
精彩评论