消息提示弹层滚动JQUERRY
/*风*/ var Life={}; Life.pmLoad=function(){ $.getJSON('json.js', function(d){ if(d&&d.res=='ok'){ if(d.count>0){ var arr=new Array(); i=0; for( a in d.data ){ var r=d.data[a]; arr.push('<div >'); arr.push('<span >'); arr.push('<span >【最新消息】</span>'); arr.push('<span >X</span>'); arr.push('</span>'); arr.push('<div >'); if(r.url&&r.url!=''){ arr.push('<a href="'+r.url+'" target="_blank" >'+r.msg+'</a>'); }else{ arr.push('<a href="home.php?mod=space&do=pm&subop=view&touid=1#bottom" target="_blank" >'+r.msg+'</a>'); } arr.push('</div></div>'); i++; } Life.Num=i; $('#pmWrapHtml').html(arr.join('')); Life.pmGo(); } } }); } Life.pmClose=function(id){ $('#life_pm_'+id).hide(); } Life.pmClick=function(id){ $.get("index.php?r=pm/click&#pmWrap"); $("#pmWrapHtml div.fuc_news").each(function(){ tmphtmlHeight=tmphtmlHeight-98; $(this).css("top",tmphtmlHeight+"px"); }); PmWap.height(floatNewsBoxsHeight).show(); PmHtml.css('height',htmlHeight+'px').css('top',floatNewsBoxsHeight+'px').animate({'top':(floatNewsBoxsHeight-htmlHeight)+'px'},Life.Num*0.5*1000); //关闭层 $("#pmWrapHtml div.fuc_news .fc_tit .tit_r").click(function(){ var tParent=$(this).parent().parent(); tParent.hide(); s_p=tParent.index(); PmNum++; tmphtmlHeight=Life.Num*98; for (var i=0;i<Life.Num;i++){ tmphtmlHeight=tmphtmlHeight-98; if(i<=s_p){ continue; } $("#pmWrapHtml div.fuc_news:eq("+i+")").animate({'top':(tmphtmlHeight+PmNum*98)+'px'}); } }); //浏览器滚动 s_top= PmWap.css("top"); $(window).scroll(function(){ var ss_top=parseInt(s_top); var sc_top=$(this).scrollTop(); var su_top=ss_top+sc_top PmWap.css("top",su_top+"px") }); } $(document).ready(function(){ Life.pmLoad(); })案例地址:https://download.csdn.net/detail/wljk506/5166607
最后更新:2017-04-03 21:30:11