原生js制作左侧浮动可折叠在线客服代码



110 439 147



特效描述:原生js制作 左侧浮动 可折叠在线客服,左侧浮动可折叠在线客服

代码结构

1. HTML代码

<div style="height:1000px;"></div>
<style type="text/css">
*{margin:0;padding:0;list-style-type:none;}
a,img{border:0;}
body{font:12px/180% Arial, Helvetica, sans-serif, "新宋体";}
/* onlinebox */
.onlinebox{width:157px;float:left;}
.onlinebox-t{background:url(images/img3-5_2.png) no-repeat;width:157px;height:39px;overflow:hidden;}
.onlinebox-m{padding:0px 0 20px 0;background:url(images/img3-5_3.png) repeat-y;}
.onlinebox-m li{padding:15px 0 0 0;text-align:center;}
.onlinebox-m .yellow{color:#ff6600;font-weight:800;}
.onlinebox-m li .qqt{border:solid 1px #ffd2bf;padding:5px;line-height:24px;width:80px;margin:0 auto;}
.onlinebox-b{width:157px;height:8px;overflow:hidden;background:url(images/img3-5_4.png) no-repeat;}
.onbtn{margin:104px 0 0 -5px;width:32px;height:139px;overflow:hidden;background:url(images/img3-5_1.png) no-repeat;float:left;display:inline;}
</style>
<div id="serviceQQ" onmouseover="toBig()" onmouseout="toSmall()">
	<div class="onlinebox">
		<div class="onlinebox-t"></div>
		<ul class="onlinebox-m">
			<li class="yellow">QQ:105673632</li>
			<li class="yellow">QQ:820778544</li>
			<li><a target="_blank" href="http://www.dijiuzhanzhang.com/"><img width="90" border="0" height="25" src="images/img3-5-btn1.gif"></a></li>
			<li><a target="_blank" href="http://www.dijiuzhanzhang.com/"><img width="90" border="0" height="25" src="images/img3-5-btn2.gif"></a></li>
			<li>
				<p class="qqt">会员交流群<br /><span class="yellow">2745645722</span></p>
				<p class="qqt">会员交流群<br /><span class="yellow">6518954422</span></p>
			</li>
		</ul>
		<div class="onlinebox-b"></div>
	</div>
	<div class="onbtn"></div>
</div>
<script type="text/javascript">
online=function(id,_top,_left){
	var me=id.charAt?document.getElementById(id):id, d1=document.body, d2=document.documentElement;
	d1.style.height=d2.style.height='100%';
	me.style.top=_top?_top+'px':0;
	me.style.left=_left+"px";
	me.style.position='absolute';
	setInterval(function(){
		me.style.top=parseInt(me.style.top)+(Math.max(d1.scrollTop,d2.scrollTop)+_top-parseInt(me.style.top))*0.1+'px';
	},10+parseInt(Math.random()*20));
	return arguments.callee;
};
window.onload=function (){
	online('serviceQQ',100,-152);
}
lastScrollY=0; 
var InterTime = 1;
var maxWidth=-1;
var minWidth=-152;
var numInter = 8;
var BigInter ;
var SmallInter ;
var o =  document.getElementById("serviceQQ");
var i = parseInt(o.style.left);
function Big(){
	if(parseInt(o.style.left)<maxWidth){
		i = parseInt(o.style.left);
		i += numInter;	
		o.style.left=i+"px";	
		if(i==maxWidth)
		clearInterval(BigInter);
	}
}
function toBig(){
	clearInterval(SmallInter);
	clearInterval(BigInter);
	BigInter = setInterval(Big,InterTime);
}
function Small(){
	if(parseInt(o.style.left)>minWidth){
		i = parseInt(o.style.left);
		i -= numInter;
		o.style.left=i+"px";
		if(i==minWidth)
		clearInterval(SmallInter);
	}
}
function toSmall(){
	clearInterval(SmallInter);
	clearInterval(BigInter);
	SmallInter = setInterval(Small,InterTime);
}
</script>



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: flash导航菜单 flash导航条 flash导航 flash菜单 flash下拉菜单 flash下拉导航菜单 h5动画导航 h5动画菜单 html5动画导航 html5动画菜单 收缩菜单 收缩导航 右键菜单 导航切换 菜单切换 浮动菜单 浮动导航 滑动导航菜单 滑动导航 滑动菜单 滚动导航菜单 滚动菜单 滚动导航 浮动 悬浮 悬浮层 悬浮框 浮动层 浮动框 浮动插件 悬浮插件 滑动星星打分 收缩展开 展开收缩 收缩 展开 浮动提示框 在线客服 导航菜单 导航条 菜单栏 导航栏 分类导航 响应式导航条 响应式导航 其他 浮动菜单 浮动导航 收缩菜单 收缩导航 qq在线客服 qq客服 在线客服插件 侧边菜单 侧边导航 鼠标滑过 鼠标悬停 跟随鼠标移动

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到