这是我在这里发表的关于堆栈溢出的第一篇文章,但是读了很多,学习了很多。
我使用jquery函数,它用.load函数在wordpress主题中加载post。
但现在我有一个问题是我自己解决不了的。
$(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;
}); });
问题是,在加载之前,我无法将它发送到slideDown。有人知道什么是不对的吗?
除了slideDown效应,一切都很好。
编辑:
也许我搞错了,把它搞错了。
我是这样说的,这是错的吗?
$("#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});
});发布于 2011-02-22 18:35:59
您需要将.load()放在.slideDown()的回调中。
$("#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});
});//编辑:
$("#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});
});https://stackoverflow.com/questions/5082150
复制相似问题