Jquery scrollTo在IE7中出现问题
我有一个页面,使用jQuery的scrollTo插件来管理一些function。 如果要从登录页面重置密码,它会滚动到新表单而不是将用户带到新页面。 当然,除了IE7之外,一切都运行良好。 这是我的HTML:
Confirmation Sent
Please check your email for instructions
on resetting your password.
Your confirmation email will come from donotreply@mygrizzly.com. Be sure to add this to your spam filter so you will be able to receive this email.
Return to login screen
我的CSS(所有这些都很重要):
.login #content #blocksWrapper { background: url(../images/login/bgBlock.png); height: 127px; margin: 0 0 50px 9px; overflow: hidden; padding: 20px 18px; width: 437px; } .login #content #blocks { height: 127px; overflow: hidden; width: 1377px; } .login #content .block { float: left; height: 127px; margin-right: 18px; position: relative; width: 441px; }
而我的jQuery:
$('#forgot a').click(function() { $('#blocksWrapper').scrollTo({left: 459, top: 0}, 400); return false; }); $('#formPasswordSubmit').click(function() { $('#blocksWrapper').scrollTo({left: 918, top: 0}, 400); return false; }); $('#confirm h4 a').click(function() { $('#blocksWrapper').scrollTo({left: 0, top: 0}, 200); return false; });
代码摘录在此页面上:[修复时编辑]
如您所见,它在除IE7之外的所有浏览器中都能正常工作。 在IE7中,它滚动#blocksWrapper div的背景而不是#blocks div的内容。 由于某些原因,IE7也没有隐藏溢出。 有人有主意吗?
我尝试使用#blocks作为我的jQuery选择器进行测试,这不是问题。
谢谢你,马库斯
我能够通过添加位置来解决这个问题:相对于包装元素。
.login #content #blocksWrapper { background: url(../images/login/bgBlock.png); height: 127px; margin: 0 0 50px 9px; overflow: hidden; padding: 20px 18px; position: relative; width: 437px; }