请教一下大家,这是悬浮窗的js,但是每次打开我也悬浮窗都是缩进去的,怎么改让悬浮窗在每次打开网页是展开的呢?
$('.kf .kf-side').click(function(){
//$('.kf').animate({ right: '-208' }, "slow");
var rt = $('.kf').css("right");
//alert(rt);
var num = parseInt(rt);
//alert(num);
if(num < 0){
$('.kf').animate({ right: '20px' }, "slow");
$('.kf .kf-side span.arrow').addClass('on');
}else{
$('.kf').animate({ right: '-208px' }, "slow");
$('.kf .kf-side span.arrow').removeClass('on');
}
});
$('.kt-top span.close').click(function(){
$('.kf').animate({ right: '-208px' }, "slow");
});
//返回顶部
$('.kf .backTop').click(function() {
$("html,body").stop().animate({ scrollTop: '0' }, 500);
});
});
$('.kf .kf-side').click(function(){ //$('.kf').animate({ right: '-208' }, "slow"); var rt = $('.kf').css("right"); //alert(rt); var num = parseInt(rt); //alert(num); if(num < 0){ $('.kf').animate({ right: '-280px' }, "slow"); $('.kf .kf-side span.arrow').removeClass('on'); }else{ $('.kf').animate({ right: '20px' }, "slow"); $('.kf .kf-side span.arrow').addClass('on'); } }); $('.kt-top span.close').click(function(){ $('.kf').animate({ right: '20px' }, "slow"); }); //返回顶部 $('.kf .backTop').click(function() { $("html,body").stop().animate({ scrollTop: '0' }, 500); }); });