消息提示弹层滚动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 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 class="fuc_news" id="life_pm_'+r.logid+'">');
					arr.push('<span class="fc_tit">');
					arr.push('<span class="tit_l">【最新消息】</span>');
					arr.push('<span class="tit_r" >X</span>');
					arr.push('</span>');
					arr.push('<div class="fc_con clearfixs">');
					if(r.url&&r.url!=''){
						arr.push('<a href="'+r.url+'" target="_blank" onclick="Life.pmClick('+r.logid+')">'+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&id="+id);
}
Life.pmGo=function(){
	var s_top=0;
	var s_p=0;
	var PmNum=0;
	//浏览器高度
	var browserHeight=$(window).height();
	//HTML高度
	var tmphtmlHeight=htmlHeight=Life.Num*98;
	//滚动外框高度
	var floatNewsBoxsHeight=browserHeight;
	var PmHtml=$('#pmWrapHtml');
	var PmWap=$("#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();
})
案例地址:http://download.csdn.net/detail/wljk506/5166607
目录
相关文章
|
3月前
|
JavaScript
弹出窗(原生js)
弹出窗(原生js)
13 0
|
前端开发
Window对象提示框、确认框、输入框、弹窗详解
本文目录 1. 背景 2. alert提示框 3. confirm确认框 4. prompt输入框 5. showModalDialog弹窗 6. 小结
1067 0
Window对象提示框、确认框、输入框、弹窗详解
|
C# Windows 容器
C#或Winform中的消息通知之系统托盘的气泡提示窗口(系统toast通知)、ToolTip控件和ToolTipText属性
NotifyIcon控件表示系统右下角任务栏上的托盘图标,其ShowBalloonTip方法用于显示气球状提示框(Win10只有为本地Toast通知),ToolTip\oolTipText可以...
1471 0
C#或Winform中的消息通知之系统托盘的气泡提示窗口(系统toast通知)、ToolTip控件和ToolTipText属性
|
3天前
|
JavaScript 前端开发 容器
随着页面的滚动导航条跟着滚动
随着页面的滚动导航条跟着滚动
|
2月前
uniapp popup弹出窗详解以及相关属性
uniapp popup弹出窗详解以及相关属性
55 3
|
3月前
|
前端开发 JavaScript 数据安全/隐私保护
前端点击其他输入框的时候,对当上个输入框进行判断(鼠标移出输入框事件,和鼠标点击其他输入框触发事件)
前端点击其他输入框的时候,对当上个输入框进行判断(鼠标移出输入框事件,和鼠标点击其他输入框触发事件)
41 0
|
4月前
页面监听键盘事件
页面监听键盘事件
|
5月前
|
小程序 JavaScript
小程序底部动画弹框
小程序底部动画弹框
41 0
|
5月前
|
前端开发
uniapp checkbox样式失效,选中框选中按钮不显示
uniapp checkbox样式失效,选中框选中按钮不显示
84 0
|
8月前
|
前端开发
上传图片组件的悬停显示删除等操作遮罩层
上传图片组件的悬停显示删除等操作遮罩层