使用AJAX加载页面时出现问题。我使用jquery创建了pinterest类型排列。
但是当我使用Ajax加载它不起作用时。
我已经搜索了它并找到bind()函数。但是如何在JQuery中将它与.css一起使用。搜索后发现的结果并不令人满意。
请更改您的功能,例如
function indmoreclik(a,b)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("more").innerHTML=xmlhttp.responseText;
var t1=0;
var t2=0;
var t3=0;
for(j=1;j<=20;j++)
{
$('.div1:nth-child('+j+')').css({ top:''+t1+'px',left:'250px'});
height=$('.div1:nth-child('+j+')').outerHeight(true);
t1=t1+height;
$('.div2:nth-child('+j+')').css({ top:''+t2+'px',left:'520px'});
height=$('.div2:nth-child('+j+')').outerHeight(true);
t2=t2+height;
$('.div3:nth-child('+j+')').css({ top:''+t3+'px',left:'790px'});
height=$('.div3:nth-child('+j+')').outerHeight(true);
t3=t3+height;
}
}
xmlhttp.open("GET","tap2.php?tun="+a+"&inc="+b,true);
xmlhttp.send();
}