加载更多的效果怎么做啊,就是会自动加载下一页的文章内容到首页而不用翻页来看那样子的,有没有直接用的什么代码或者插件之类的,新手不懂。

解决方案 »

  1.   

    是直接改变div的值吗?不很明白你的意思
      

  2.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    </head>
    <body > 
    <div id="divId" style="background:#f00; height:1000px; overflow:hidden;">
        <div style="height:1500px;"></div>
    </div>
    <script type="text/javascript">
        window.onscroll = function () {
            var a = document.documentElement.scrollTop == 0 ? document.body.clientHeight : document.documentElement.clientHeight;
            var b = document.documentElement.scrollTop == 0 ? document.body.scrollTop : document.documentElement.scrollTop;
            var c = document.documentElement.scrollTop == 0 ? document.body.scrollHeight : document.documentElement.scrollHeight;
      
      
            if (b != 0) {
                if (a + b == c) {
                    showmore();
                }
            }
        }
        function showmore() {
            //alert($('#divId div:last-child').offset().top + parseInt($('#divId div:last-child').height()));
            if(parseInt($('#divId').height()) < ($('#divId div:last-child').offset().top + parseInt($('#divId div:last-child').height()))) {
                $('#divId').css('height', '+=100px');
            }
             
            }
    </script>
      
      
    </body>
    </html>
      

  3.   

    jquery就可以实现 ajax动态修改html的内容 如果想要更好的用户体验的话 可以添加一点动画的效果什么的 
      

  4.   

    ajax 怎么读取下一页的内容加载到首页来啊,请教有没有这方面的源码给看看