网站首页  汉语字词  英语词汇  考试资料  写作素材  旧版资料

请输入您要查询的考试资料:

 

标题 Blocksit插件实现瀑布流数据无限( 异步)加载
内容
    BlocksIt 瀑布流插件是基于jquery的,使用也非常简单,是为数不多的几款动态瀑布流插件之一。
    html代码:
    <div> 
      <div id="kppcl">
        <div>
          <div>
            <div><a href='{#url_reset("activity/detail","id_{#$item.id#}")#}'><img src="{#$item.logo#}" width="322" /></a></div>
            <div><a href='{#url_reset("activity/detail","id_{#$item.id#}")#}'>{#$item.title#}</a></div>
            <div>
              <table cellspacing="0" cellpadding="0">
                <tr>
                  <th>时    间:</th>
                  <td>{#$item.start_date#}-{#$item.end_date#}</td>
                </tr>
                <tr>
                  <th>地    点:</th>
                  <td>{#$item.area_name#}</td>
                </tr>
              </table>
            </div>
          </div>
          <div></div>
        </div>
        <div>
          <div>
            <div><a href='{#url_reset("activity/detail","id_{#$item.id#}")#}'><img src="{#$item.logo#}" width="322" /></a></div>
            <div><a href='{#url_reset("activity/detail","id_{#$item.id#}")#}'>{#$item.title#}</a></div>
            <div>
              <table cellspacing="0" cellpadding="0">
                <tr>
                  <th>时    间:</th>
                  <td>{#$item.start_date#}-{#$item.end_date#}</td>
                </tr>
                <tr>
                  <th>地    点:</th>
                  <td>{#$item.area_name#}</td>
                </tr>
              </table>
            </div>
          </div>
          <div></div>
        </div>
        <div>
          <div>
            <div><a href='{#url_reset("activity/detail","id_{#$item.id#}")#}'><img src="{#$item.logo#}" width="322" /></a></div>
            <div><a href='{#url_reset("activity/detail","id_{#$item.id#}")#}'>{#$item.title#}</a></div>
            <div>
              <table cellspacing="0" cellpadding="0">
                <tr>
                  <th>时    间:</th>
                  <td>{#$item.start_date#}-{#$item.end_date#}</td>
                </tr>
                <tr>
                  <th>地    点:</th>
                  <td>{#$item.area_name#}</td>
                </tr>
              </table>
            </div>
          </div>
          <div></div>
        </div>
      </div>
      <div id="page">
        <div><b>上一页</b><b>1</b><a href="?p=2">2</a><a href="?p=2" rel="2">下一页</a></div>
      </div>
    </div>
    js代码
    <script src="/js/blocksit.min.js"></script>
    <script language="javascript" type="text/javascript">
      $(window).load( function() {
        $('#kppcl').BlocksIt({
          numOfCol: 3,
          offsetX: 5,
          offsetY: 5
        });
      });
      var current_p = 0;
      //滚动
      $(window).scroll(function(){
        // 当滚动到最底部以上100像素时, 加载新内容
        if ($(document).height() - $(this).scrollTop() - $(this).height()<100) {
          ajax_load_data();
        }
      });
      function ajax_load_data(){
        var next_p = $('#page').find('.nextprev').attr('rel');
        if(next_p && next_p != current_p){
          console.log('nextpage = '+next_p);
          current_p = next_p;
          $.ajax({
            url:'{#url_reset("request/front/ajax","","php")#}',
            data:{'act':'ajax_forum','p':next_p},
            dataType:'json',
            type:'post',
            beforeSend:function(){
              show_loading_body();
            },
            complete:function(){
              show_loading_body();
            },
            success:function(data){
              if(data.status != undefined && data.status == 'ok'){
                if(data.html){
                  $('#kppcl').append(data.html).BlocksIt('reload');
                }
                if(data.pages_str){
                  $('#page').html(data.pages_str);
                }
              }
            }
          });
        }
      }
    </script>
随便看

 

在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。

 

Copyright © 2002-2024 cuapp.net All Rights Reserved
更新时间:2025/5/19 3:20:46