我一直在尝试用jQuery. animate滚动一个long/large。但我没有得到任何移动。我包括了div的html和. animate前后的输出。
如有任何帮助,我们将不胜感激。
<div id="content" style="height: 868px;">
This height: is calculated and placed here by jquery onready function.
It is hight of window - Header - Footer.
<div id="content_row" style="height:inherit overflow:hidden;">
<div id="scroll_me" style="width:100%; height:auto; margin-left:auto; margin-right:auto; margin-top:0.8rem;">
function downScroll() {
...
// Debug info of variables done here!
console.log( "my_scroll_container: " + my_scroll_container );
console.log( "my_container_height: " + $(my_scroll_container).height() );
console.log( "my_scroll_selector: " + my_scroll_selector );
console.log( "my_scroll_selector_height: " + $(my_scroll_selector).height() );
console.log( "myPos: " + $(my_scroll_selector).scrollTop() );
console.log( "max_scroll: " + max_scroll_distance );
console.log( "swing_time: " + swing_time );
$(my_scroll_selector)
.stop(true, false)
.animate( { scrollTop: max_scroll_distance },
swing_time,
'swing',
function() {
//$(my_scroll_selector).trigger( 'up.startScroll' );
} );
}
JUST BEFORE ANIMATE
my_scroll_container: #content_row
my_container_height: 984
my_scroll_selector: #scroll_me
my_scroll_selector_height: 1587.2
myPos: 0 // Expected postion, just loaded page.
max_scroll: 603
swing_time: 3000
ANIMATION FINISHED:
my_scroll_container: #content_row
my_container_height: 984
my_scroll_selector: #scroll_me
my_scroll_selector_height: 1587.2
myPos: 0 // This did not change here or on screen!
max_scroll: 603
swing_time: 3000
字符串
1条答案
按热度按时间nlejzf6q1#
好吧,我终于弄明白了!我应该对我来说很明显......我正在将动画应用到作为“数据”的div上。
动画应适用于指定的“查看端口”,这是小于数据的div!
字符串