<div class="lead-more" id="lead-more" style="margin-top: 120px;"><a href="javascript:;">查看更多>></a></div>
$(document).ready(function(){
$("#lead-more").click(function(){
$(this).html('<img src="images/lead.gif" height="30" alt="" />');
})
})
设置容器innerHTML并且启用ajax加载你的页面内容就行了,加载内容完毕会自动替换显示的图片
$("#lead-more").click(function () {
$(this).html('<img src="/images/lead.gif" height="30" alt="" />').load('你的url');
})
目标元素相对定位,在目标元素中放一个绝对定位的加载中图片,图片元素样式隐藏,点击时图片显示,当动态加载数据的回调函数执行时(也就是加载完成了)
图片隐藏就OK了
$("#lead-more").click(function() {
if (document.readyState == "loading ") {
$(this).html('<img src="/images/lead.gif" height="30" alt="" />');
}
})
这样不知道对不对,看不出来效果