你好我有
的大问题 $(window).load(function() { // this not working in chrome
和
$(document).load(function() { // this not working in firefox
如果我使用第一个,它将不会在chrome中被触发
如果我使用第二个,它将不会在firefox中被触发
如何解决这个问题?
我试图像那样滚动页面
<script type="text/javascript">
$(document).load(function() {
$("html, body ").animate({ scrollTop: $(document).height() }, 10);
});
$(document).ready(function () {
// some othe code here which doesnt affect anything just to show that im using document ready here
});
</script>
如果有人想知道,我也会将代码中的$(window).height()
更改为document
修改
$(document).load(function() {
$("html, body , #mydiv1,#mydiv2").animate({ scrollTop: $(document).height() }, 10);
});
$(document).ready(function () {
var $window = $(document),
$stickyEl = $('#listholder'),
elTop = $stickyEl.offset().top;
$window.scroll(function() {
$stickyEl.toggleClass('sticky', $window.scrollTop() > elTop);
});
scroll("#mydiv1,#mydiv2");
});