


jquery implements the qq online customer service plug-in example floating on the right side of the web page_jquery
A very practical QQ online customer service code. Click the QQ icon to directly talk to customer service. The specific implementation code is as follows:
html page:
css style:
/*default blue*/
.SonlineBox{ width:162px; font-size:12px;overflow:hidden; z-index:9999;}
.SonlineBox .openTrigger{ width:30px; height:110px; position:absolute; top:0px; z- index:1; cursor:pointer; background:#0176ba url(../images/openTrigger.jpg) no-repeat;}
.SonlineBox .titleBox{ width:158px; height:35px; line-height:35px; background:#038bdc url(../images/SonlineTitleBg.gif) repeat-x; border-bottom:2px solid #0176ba;}
.SonlineBox .titleBox span{ margin-left:10px; color:#fff; font -size:14px; font-family:'Microsoft YaHei','HeiTi';}
.SonlineBox .contentBox{ width:158px; height:auto; border:2px solid #0176ba; background:#fff; position: absolute; z-index:2;}
.SonlineBox .contentBox .closeTrigger{ width:25px; height:25px; display:block; cursor:pointer; position:absolute; top:5px;right:5px;-webkit- transition:all 0.8s ease-out;}
.SonlineBox .contentBox .closeTrigger:hover{-webkit-transform:scale(1) rotate(360deg);}
.SonlineBox .contentBox .listBox{overflow:hidden ; margin-bottom:10px;}
.SonlineBox .contentBox .listBox .QQList{ display:block; width:86%; height:22px; margin:10px auto 0px auto;}
.SonlineBox .contentBox .listBox .QQList span{float:left; line-height:22px;}
.SonlineBox .contentBox .listBox .QQList a{float:left;}
jquery script code:
/*
此插件基于Jquery
开发者 yaohucaizi
Blog:http://blog.csdn.net/yaohucaizi/
*/
(function($){
$.fn.Sonline = function(options){
var opts = $.extend({}, $.fn.Sonline.defualts, options);
$.fn.setList(opts); //调用列表设置
if(opts.DefaultsOpen == false){
$.fn.Sonline.close(opts.Position,0);
}
//展开
$("#SonlineBox > .openTrigger").live("click",function(){$.fn.Sonline.open(opts.Position);});
//关闭
$("#SonlineBox > .contentBox > .closeTrigger").live("click",function(){$.fn.Sonline.close(opts.Position,"fast");});
//Ie6兼容或滚动方式显示
if ($.browser.msie && ($.browser.version == "6.0") && !$.support.style||opts.Effect==true) {$.fn.Sonline.scrollType();}
else if(opts.Effect==false){$("#SonlineBox").css({position:"fixed"});}
}
//plugin defaults
$.fn.Sonline.defualts ={
Position:"left",//left或right
Top:200,//顶部距离,默认200px
Effect:true, //滚动或者固定两种方式,布尔值:true或
DefaultsOpen:true, //默认展开:true,默认收缩:false
Qqlist:"" //多个QQ用','隔开,QQ和客服名用'|'隔开
}
//展开
$.fn.Sonline.open = function(positionType){
var widthValue = $("#SonlineBox > .contentBox").width();
if(positionType=="left"){$("#SonlineBox > .contentBox").animate({left: 0},"fast");}
else if(positionType=="right"){$("#SonlineBox > .contentBox").animate({right: 0},"fast");}
$("#SonlineBox").css({width:widthValue+4});
$("#SonlineBox > .openTrigger").hide();
}
//关闭
$.fn.Sonline.close = function(positionType,speed){
$("#SonlineBox > .openTrigger").show();
var widthValue =$("#SonlineBox > .openTrigger").width();
var allWidth =(-($("#SonlineBox > .contentBox").width())-6);
if(positionType=="left"){$("#SonlineBox > .contentBox").animate({left: allWidth},speed);}
else if(positionType=="right"){$("#SonlineBox > .contentBox").animate({right: allWidth},speed);}
$("#SonlineBox").animate({width:widthValue},speed);
}
//子插件:设置列表参数
$.fn.setList = function(opts){
$("body").append("

if(opts.Qqlist==""){$("#SonlineBox > .contentBox > .listBox").append("
暂无在线客服。
")}else{var qqListHtml = $.fn.Sonline.splitStr(opts);$("#SonlineBox > .contentBox > .listBox").append(qqListHtml); }
if(opts.Position=="left"){$("#SonlineBox").css({left:0});}
else if(opts.Position=="right"){$("#SonlineBox").css({right:0})}
$("#SonlineBox").css({top:opts.Top});
var allHeights=0;
if($("#SonlineBox > .contentBox").height() < $("#SonlineBox > .openTrigger").height()){
allHeights = $("#SonlineBox > .openTrigger").height()+4;
} else{allHeights = $("#SonlineBox > .contentBox").height()+4;}
$("#SonlineBox").height(allHeights);
if(opts.Position=="left"){$("#SonlineBox > .openTrigger").css({left:0});}
else if(opts.Position=="right"){$("#SonlineBox > .openTrigger").css({right:0});}
}
//滑动式效果
$.fn.Sonline.scrollType = function(){
$("#SonlineBox").css({position:"absolute"});
var topNum = parseInt($("#SonlineBox").css("top")+"");
$(window).scroll(function(){
var scrollTopNum = $(window).scrollTop();//获取网页被卷去的高
$("#SonlineBox").stop(true,true).delay(0).animate({top:scrollTopNum+topNum},"slow");
});
}
//分割QQ
$.fn.Sonline.splitStr = function(opts){
var strs= new Array(); //定义一数组
var QqlistText = opts.Qqlist;
strs=QqlistText.split(","); //字符分割
var QqHtml=""
for (var i=0;i
var subQqlist = strs[i];
subStrs = subQqlist.split("|"); //字符分割
QqHtml = QqHtml+""
}
return QqHtml;
}
})(jQuery);
The rendering is as follows:


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

You can freely contact customer service on WeChat to help you solve problems encountered during use. Some users don’t know where to find WeChat’s online customer service. Just select online consultation in the help and feedback settings. This introduction to the WeChat online customer service contact method will tell you the specific operation method. The following is a detailed introduction, take a look! WeChat usage tutorial Where to find answers to WeChat online customer service: Select online consultation in the help and feedback settings. Specific methods: 1. Click [Settings] in [Me]. 2. Scroll down and click [Help and Feedback]. 3. Click [Online Consultation] in the lower right corner. 4. You can automatically jump to Tencent customer service. If you need manual service, just enter [Manual] and send.

Methods and techniques on how to achieve floating animation effects through pure CSS. In modern web design, animation effects have become one of the important elements that attract users’ attention. One of the common animation effects is the floating effect, which can add a sense of movement and vitality to the web page, making the user experience richer and more interesting. This article will introduce how to achieve floating animation effect through pure CSS, and provide some code examples for reference. 1. Use the transition attribute of CSS to achieve the floating effect. The transition attribute of CSS can

What should I do if the Win7 taskbar is displayed in the window on the right side of the desktop? Under normal circumstances, the taskbar is at the bottom of the screen by default, but recently some Win7 users found that the taskbar has moved to the right window of the screen when they turned on the computer. So is there any way to change it back? Many friends don’t know how to operate in detail. The editor below has compiled the steps to solve the problem of the Win7 taskbar displaying in the window on the right side of the desktop. If you are interested, follow the editor to take a look below! Win7 taskbar is displayed in the window on the right side of the desktop. Solution steps 1. First, we right-click the taskbar in the window on the right side of the desktop and select Properties, as shown in the figure below: 2. In the opened taskbar and properties window, click on the taskbar on the screen Select the bottom location, check Lock taskbar, and click

How to use PHP Developer City to implement online customer service functions In the modern e-commerce market, providing high-quality online customer service has become one of the important means for merchants to attract customers and maintain customer satisfaction. With the rapid development of PHP development technology, it has become a common choice to use PHP to develop online customer service functions of the mall. This article will introduce how to use PHP Developer City to implement online customer service functions. Determine the needs of online customer service Before starting development, we need to clarify the online customer service functions we want to implement. We can consider the following

With the development of WeChat mini programs, more and more companies have begun to develop marketing and sales businesses on WeChat mini programs. The online customer service system is one of the important channels for communication between enterprises and customers. This article will introduce how to use PHP to implement the WeChat mini program online customer service system. 1. Introduction to the WeChat Mini Program Customer Service System The WeChat Mini Program customer service system, also known as the WeChat public account online customer service system, refers to a network platform built by enterprises on the WeChat platform to communicate with customers. Through the WeChat mini program customer service system, companies can provide online customer service consultation and order inquiries.

With the development of the Internet, more and more companies have begun to pay attention to the development and use of online customer service applications to improve user experience and reduce labor costs. As a programming language with both flexibility and stability, Java language has also become the first choice for enterprises to develop online customer service applications. This article will introduce the development of online customer service applications in Java language. 1. Basic principles of online customer service application Online customer service application is a real-time communication application that enables instant communication between enterprises and customers through professional communication technology. Technologies used by online customer service

PHPWebSocket development skills: Implementing a multi-functional online customer service system Introduction: With the rapid development of the Internet, more and more companies are realizing the importance of online customer service systems in improving customer service quality and increasing conversion rates. As a real-time communication technology, PHP WebSocket is increasingly used in online customer service systems. This article will introduce some PHPWebSocket development techniques to help developers implement a multi-functional online customer service system. 1. Understand WebSocket

Users can contact online customer service in JD.com to have a conversation. Some users do not know how to contact JD.com online customer service. Click online customer service in My Customer Service, click Contact Manual Customer Service after sending the manual transfer, and enter manual service. This introduction to online customer service contact methods will tell you exactly how to operate it, so come and take a look! How to contact JD.com’s online customer service? Answer: Click on online customer service in My Customer Service. After sending the transfer, click to contact manual customer service. Enter manual service for detailed introduction: 1. Enter JD.com and click [Customer Service] in [My]. 】. 2. Click [Online Customer Service] at the bottom. 3. Enter and send [Transfer to Manual], and click [Contact Manual Customer Service]. 4. Select the question you want to know about, and then click [Enter Manual]
