請(qǐng)教一下大家,這是懸浮窗的js,但是每次打開我也懸浮窗都是縮進(jìn)去的,怎么改讓懸浮窗在每次打開網(wǎng)頁是展開的呢?
$('.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); }); });$('.kf .kf-side span.arrow').addClass('on');
加在這段js前面
回復(fù)@helloweb 二樓失敗,按照你的代碼浮窗所在里面了,點(diǎn)頁點(diǎn)不開了
