基本上我有一个页面,有1000+图像,它需要永远加载。什么是最好的方法来使用,只加载前10张图片,然后当用户向下滚动或点击按钮后,下10张图片加载。
Thanks in advance
$large = 'large';
$q = $handler->prepare("SELECT * FROM ads WHERE status = ? AND slot = ? LIMIT 0, 5");
$q->bindParam(1, $live);
$q->bindParam(2, $large);
$q->execute();
if($q->rowCount() > 0){
echo '<div style="margin-top: 5px; margin-bottom: 5px; width: 1020px; border: 2px solid #428bca"></div>';
while($r = $q->fetch()){
$web = $r['website_url'];
$img = $r['image_url'];
{
echo '
<a target="_blank" href="'.$web.'"><img style="margin-left: -4px" src="'.$img.'" height="150" width="150" onmouseout="shrink2(this);" onmouseover="expand2(this);"/></a>
';
}
}
}
it x 10000
这只是一个查询,显然我不能输入所有1000多个查询
我是这样用的。也很容易设置:)
http://plugins.jquery.com/lazyload/示例页面:http://www.appelsiini.net/projects/lazyload/enabled_fadein.html