让在线客服固定,不随滚动条向下滚动,js
$(document).ready(function(){vardestDiv=$("#divSerWin");varstartPos=destDiv.position(...
$(document).ready(function(){
var destDiv = $("#divSerWin");
var startPos = destDiv.position().top;
var divHeight = destDiv.outerHeight();
$(window).scroll(function (){
scrTop = $(window).scrollTop();
if( startPos < scrTop){
topPos = startPos+(scrTop - startPos)+10;
$("#divSerWin").css("position", "fixed").css("top", topPos +"px").css('zIndex', '500');
}
});
});
function ClickSer(){
var obj=$("#divMySer")
if( obj.attr("class") == "service-open" )
$("#divMySer").removeClass("service-open").addClass("service-close");
else
$("#divMySer").removeClass("service-close").addClass("service-open");
} 展开
var destDiv = $("#divSerWin");
var startPos = destDiv.position().top;
var divHeight = destDiv.outerHeight();
$(window).scroll(function (){
scrTop = $(window).scrollTop();
if( startPos < scrTop){
topPos = startPos+(scrTop - startPos)+10;
$("#divSerWin").css("position", "fixed").css("top", topPos +"px").css('zIndex', '500');
}
});
});
function ClickSer(){
var obj=$("#divMySer")
if( obj.attr("class") == "service-open" )
$("#divMySer").removeClass("service-open").addClass("service-close");
else
$("#divMySer").removeClass("service-close").addClass("service-open");
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询