$(function(){ // 页数 var page = 0; // 每页展示5个 var size = 5; // 上滑加载 $('.list_box_cen').dropload({ // 调用加载 scrollArea : window, // threshold:2/3, loadDownFn : function(me){ page++; $('.dropload-down').show(); $.ajax({ type: 'POST', // url: './js/miracle.json?&page='+page+'&limit='+size, url: '/weirdo/homeform', dataType: 'json', data:{page:page,limit:size,csrf_token_m:csrfToken}, success: function(data){ $('.line').hide(); if(data.code == 200){ $('.list_box_cen > ul').append(ModuleWay(data.data)) //调用选择模块 var lihref =""; $('.m_fxcj').on('click',function(){ var gb = $(this).parent().find('.m_fx').attr('id') // console.log(gb) if (gb == 'no') { $(this).parent().find('.m_fx').attr('id','').parent().parent().parent().siblings().find('.m_fx').attr('id','no'); }else if(gb !== 'no'){ $(this).parent().find('.m_fx').attr('id','no'); }; lihref = $(this).attr('DataId'); console.log(lihref); /* * 动态设置百度分享URL的函数,具体参数 * cmd为分享目标id,此id指的是插件中分析按钮的ID *,我们自己的文章ID要通过全局变量获取 * config为当前设置,返回值为更新后的设置。 */ function SetShareUrl(cmd, config) { if (lihref) { config.bdUrl = "m.pinfangw.com/weirdo/details/"+lihref+"/"; } return config; } //插件的配置部分,注意要记得设置onBeforeClick事件,主要用于获取动态的文章ID window._bd_share_config = { "common": { onBeforeClick:SetShareUrl,"bdSnsKey":{},"bdText":"","bdMini":"2" ,"bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"24" }, "share": {} }; //插件的JS加载部分 with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+ ~(-new Date() / 36e5)]; }) }else{ // 锁定 me.lock(); // 无数据 me.noData(); } // alert(data); // 每次数据加载完,必须重置 // setTimeout(function(){ // // 插入数据到页面,放到最后面 // $('.news_list').append(result); // // 每次数据插入,必须重置 // me.resetload(); // },100); me.resetload(); }, error: function(xhr, type){ $('.line').show(); me.resetload(); } }); } }); function ModuleWay(data){ var _html=""; $.each(data,function (key,val) { _html += '
  • '; _html += '
    '; _html += '
    '; _html += ''; _html += '
    '; _html += '
    '; _html += '

    '; _html += ''; _html += '分享'; _html += '

    '; _html += '

    '; _html += ''; _html += ''+val.click+''; _html += '

    '; _html += '
    '; _html += ''; _html += ''; _html += ''; _html += ''; _html += ''; // _html += ''; _html += ''; _html += '
    '; _html += '
    '; _html += '
    '; if(val.short_subject != '' && val.short_subject != null){ _html += '
    '+val.short_subject+'
    '; } else { _html += '
    '+val.subject+'
    '; } _html += '
  • '; }) return _html; } })