123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- (function($) {
- var pageNo = 1;
- $.fn.lazyinit = function(options){
- var dataContainer = $(this);
-
- $(this).find('.pagination').find('.demo').on('click',function(){
- var url = $(this).attr('ds_url');
- $(dataContainer).lazyshow({url:url,iIntervalId:true});
- });
- $(this).find('.lazymore').find('a').on('click',function(){
- var url = $(this).attr('ds_url');
- $(dataContainer).lazyshow({url:url,iIntervalId:false});
- });
- }
- $.fn.lazyshow = function(options) {
- var settings = {
- iIntervalId:true
- };
-
- var loadurl = options.url;
-
- settings.iIntervalId = options.iIntervalId;
-
- var dataContainer = $(this);
-
- if(!$(dataContainer).next("#lazytmp")[0]){
- $(dataContainer).after('<div id="lazytmp"></div>');
- }
-
- if(settings.iIntervalId){
- pageNo = 1;
- }
-
- $("#lazymore").remove();
-
- $("#lazytmp").load(loadurl+'&delaypage='+pageNo,'',function(){
-
- var html = '';
- html += $("#lazymodule").html();
- if(settings.iIntervalId === false){
- $(dataContainer).append(html);
- }else{
- $(dataContainer).html(html);
- }
- $("#lazytmp").html('');
-
-
- $(dataContainer).find("#lazymore").html('<div class="lazymore"><a href="javascript:void(0);" ds_url="'+loadurl+'">查看更多动态</a></div>');
-
- $(dataContainer).find('.pagination').find('.demo').each(function(){
- var a_url = $(this).attr('href');
- if(a_url != '' && a_url != undefined){
- $(this).attr('ds_url',a_url);
- }
- $(this).attr('href','javascript:void(0);');
- });
-
-
- $(dataContainer).find('[dstype="mcard"]').membershipCard({type:'shop'});
- });
- pageNo++;
- };
- })(jQuery);
|