js 右侧漂浮滚动

来源:互联网 发布:unity3d 切换摄像机 编辑:程序博客网 时间:2024/05/17 00:07
(function() {
function a() {
var a = d.scrollTop(),
b = f.innerHeight();
var rightWidth = (window.document.body.offsetWidth - 960) / 2;
if (window.document.body.offsetWidth < 960 || (/(iPad|iPhone|iTouch|iPod|IEMobile|Android)/i.test(navigator.userAgent))) {
return
}
g.removeAttr('style'), b > i && (i > j ? a + j > h + i ? a + j > h + b ? g.height() < 560 ? g.css({
position: 'fixed',
top: '0px',
right: rightWidth + 'px'
}) : g.css({
position: 'absolute',
bottom: '0px',
right: '0px'
}) : a > i - 460 ? g.css({
position: 'fixed',
top: '0px',
right: rightWidth + 'px'
}) : g.css({
position: 'fixed',
bottom: '0px',
right: rightWidth + 'px'
}) : g.css({
position: 'static'
}) : a > h ? a + i > h + b ? g.css({
position: 'absolute',
bottom: '10px'
}) : g.css({
position: 'fixed',
top: '0px'
}) : g.css({
position: 'static'
}))
}
var b = navigator.userAgent;
if (!(b.indexOf('MSIE 6') > 0)) {
var c = $(window),
d = $(document),
e = $('.main'),
f = e.find('.cont'),
g = e.find('.sideRight'),
h = f.offset().top,
i = g.height() + 460,
j = c.height();
e.css('position', 'relative'), c.on({
scroll: a,
resize: function() {
j = c.height(), a()
}
}), a()
}
}());
0 0
原创粉丝点击