您的位置:首页 > Web前端 > JQuery

让滚动条滚动到指定位置,带动画效果 jQuery

2015-01-13 10:13 417 查看
让滚动条滚动到指定位置,带动画效果 jQuery

$('html,body').animate({scrollTop: ID.offset().top},300);


滚动到指定位置 悬浮

var oDiv=document.getElementById("float");
var H=0,iE6;
var Y=oDiv;
while(Y){H+=Y.offsetTop;Y=Y.offsetParent};
iE6=window.ActiveXObject&&!window.XMLHttpRequest;
if(!iE6){
window.onscroll=function()
{
var s=document.body.scrollTop||document.documentElement.scrollTop;
if(s>H){oDiv.className="div2 detailtext ";if(iE6){oDiv.style.top=(s-H)+"px";}
$(".qrcode img").css("position","fixed").css("top","160px");
}
else{oDiv.className="detailtext";
$(".qrcode img").removeAttr("style");
}
};
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: