在线客服 浮动
2011-04-14 15:53
274 查看
前两天用到在线客服浮动窗口,本来想偷个懒 网上拽下来用,发现 找到的都是table(不是table的不好啦,是某已经把浮窗切好了)的,而且结构很繁琐...只好自己写个(如果有人想看 我在资源上传了压缩文件,比较懒的人可以直接下载)
css:
页面代码:
js:
css:
<mce:style type="text/css"><!-- h5{ margin:0; padding:0; font-family:"宋体"; font-size:12px;} .kefu{ position:absolute; width:110px; height:150px; border-left:#d3d3d3 solid 1px; border-right:#d3d3d3 solid 1px; display:none;} .kefu h5{ height:25px; line-height:25px; color:#fff; text-indent:8px;} .kefu h5.title{ background:url(images/qq-title.gif) no-repeat;} .kefu h5.foot{ background:url(images/qq-foot.gif) no-repeat;} .kefu ul.qq_list{ padding:10px 0; width:110px; background-color:#fff;} .kefu ul.qq_list li{ height:28px; line-height:28px;text-indent:12px;} .kefu ul.qq_list li a{ text-decoration:none; color:#000;} .kefu ul.qq_list li img{ vertical-align:-5px;} .show_none{ display:none;} --></mce:style><style type="text/css" mce_bogus="1">h5{ margin:0; padding:0; font-family:"宋体"; font-size:12px;} .kefu{ position:absolute; width:110px; height:150px; border-left:#d3d3d3 solid 1px; border-right:#d3d3d3 solid 1px; display:none;} .kefu h5{ height:25px; line-height:25px; color:#fff; text-indent:8px;} .kefu h5.title{ background:url(images/qq-title.gif) no-repeat;} .kefu h5.foot{ background:url(images/qq-foot.gif) no-repeat;} .kefu ul.qq_list{ padding:10px 0; width:110px; background-color:#fff;} .kefu ul.qq_list li{ height:28px; line-height:28px;text-indent:12px;} .kefu ul.qq_list li a{ text-decoration:none; color:#000;} .kefu ul.qq_list li img{ vertical-align:-5px;} .show_none{ display:none;}</style>
页面代码:
<div class="kefu" id="floatWind"> <h5 class="title">在线客服QQ</h5> <ul class="qq_list"> <li><a target=blank href="tencent://message/?uin=12345678&Site=大拇指&Menu=yes" mce_href="tencent://message/?uin=12345678&Site=大拇指&Menu=yes"><img src="images/1_m.gif" mce_src="images/1_m.gif" width="20" height="20" /> 在线交谈</a></li> <li><a target=blank href="tencent://message/?uin=12345678&Site=大拇指&Menu=yes" mce_href="tencent://message/?uin=12345678&Site=大拇指&Menu=yes"><img src="images/4_m.gif" mce_src="images/4_m.gif" width="20" height="20" /> 在线交谈</a></li> <li><a target=blank href="tencent://message/?uin=12345678&Site=大拇指&Menu=yes" mce_href="tencent://message/?uin=12345678&Site=大拇指&Menu=yes"><img src="images/24_m.gif" mce_src="images/24_m.gif" width="20" height="20" /> 在线交谈</a></li> </ul> <h5 class="foot">在线客服QQ</h5> </div>
js:
document.documentElement.scrollTop = 0; var startY = parseInt(document.getElementById('floatWind').parentNode.scrollHeight); //设置初始状态 var x=780; //浮窗左边距 var y = 360; //规定top值 document.getElementById('floatWind').style.top = startY +'px'; //浮窗初始状态为其父容器底部 var speed= document.documentElement.scrollTop - Math.abs(startY - y); //与 y 距离 function move(){ document.getElementById('floatWind').style.top = (parseInt(document.getElementById('floatWind').offsetTop) + newSpeed(speed)) +'px'; document.getElementById('floatWind').style.left = (document.documentElement.scrollLeft + x) +'px'; startY = parseInt(document.getElementById('floatWind').offsetTop); if(Math.abs(speed) == 1){ window.clearInterval(a);} } function newSpeed(height){ //改变步长 speed= (Math.abs(speed)<1)?1:Math.ceil(height/2); return speed; } document.getElementById('floatWind').style.display = 'block'; var a = window.setInterval('move();',80); //加载 window.onscroll=function(){ window.clearInterval(a); speed = document.documentElement.scrollTop - Math.abs(startY - y); a = window.setInterval('move();',80); }
相关文章推荐
- ECshop两个自动收缩浮动在线客服代码,QQ客服、在线MSN、旺旺,兼容IE、 FF
- 腾讯提供的QQ在线样式——QQ客服功能,非浮动的!
- 在线客服代码---ECshop最新自动收缩浮动在线客服代码
- 网页HTML右侧浮动DIV层广告或在线客服图片框最佳代码(支持Firefox&IE)
- jquery.scrollfollow随浏览器上下浮动,在线客服
- jquery浮动在线客服插件
- 浮动在线客服
- (转载)带着项目学PHP第四讲 - 添加自动收缩浮动的客服(QQ客服,在线MSN,旺旺),兼容IE,Firefox
- jquery 自动收缩浮动在线客服代码,QQ客服、在线MSN、旺旺,兼容IE、 FF、Google Chrome
- 在线客服 浮动窗口
- 实例介绍:如何做一个浮动的QQ客服,还有在线MSN?而且能够随着浮动条上下移动
- 牛腩新闻发布系统 (6) 在线浮动的客服功能
- ECshop两个自动收缩浮动在线客服代码,QQ客服、在线MSN、旺旺,兼容IE、 FF
- 基于jquery打造的网页右侧自动收缩浮动在线客服代码
- 可浮动的在线qq咨询客服代码
- 牛腩新闻发布系统 (6) 在线浮动的客服功能
- 牛腩新闻发布系统 (6) 在线浮动的客服功能
- 即插即用、开源在线客服系统——PPMessage
- 53KF在线客服这些功能小而美
- jQuery实现的网页右下角tab样式在线客服效果代码