开发者

jQuery load question with slideDown effect

it's my first post here on stackoverflow, but read a lot and learning.

I using a jquery function that loads post in wordpress themes with .load function.

But now i have one problem that i can't solve by myself.

$(document).ready(function(){

$.ajaxSetup({cache:false});
$("#thumbs a").click(function(){
var post_id = $(this).attr("rel") 
$("#your_post_here").slideDown("1200", function () {
$("#your_post_here").html("<img src='http://localhost/wp-content/themes/insp/images/ajax-loader.gif' />");
$("#your_post_here").load("http://<?php echo $_SERVER[HTTP_HOST]; ?>/triqui-ajax/",{id:post_id});
});

    return false;

});

$("a.close").live("click", function(){ 
    $("#intro").slideUp(1200);
    return false;
}); 

});

The problem is i can't get it to slideDown before it's load. do someone have an idea of what can be wrong?

Everyting works fine except slideDown effect

Edit:

Maybe i get it wrong, put can't really get it to work.

I put it lik开发者_如何学Ce this, is this wrong?

$("#thumbs a").click(function(){
    var post_id = $(this).attr("rel") 
$("#your_post_here").slideDown("200", function () {
    $("#your_post_here").html("<img src='http://localhost/wp-content/themes/insp/images/ajax-loader.gif' />");
    $("#your_post_here").load("http://<?php echo $_SERVER[HTTP_HOST]; ?>/triqui-ajax/",{id:post_id});
});


You need to put the .load() in the .slideDown()'s callback.

$("#your_post_here").slideDown("200", function () {
    $("#your_post_here").html("<img src='http://localhost/wp-content/themes/insp/images/ajax-loader.gif' />");
    $("#your_post_here").load("http://<?php echo $_SERVER[HTTP_HOST]; ?>/triqui-ajax/",{id:post_id});
});

// EDIT:

$("#your_post_here").slideDown("200", function () {
    $(this).html("<img src='http://localhost/wp-content/themes/insp/images/ajax-loader.gif' />");
    $(this).load("http://<?php echo $_SERVER[HTTP_HOST]; ?>/triqui-ajax/",{id:post_id});
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜