onBeforeSeek 和 onSeek 使用 jQuery Scrollable 切换子 div?
我正在使用 jQuery Tools Scrollable 滚动一些包含一些 YouTube 剪辑的面板。我想在过渡期间隐藏它们以避免动画不稳定。
标记:
<div id="panel_items">
<div id="wrap">
<div class="event">
<div class="header">Event 1</div><!-- Header is always displayed -->
<div class="youtube">youtube clips</div><!-- hide during transition, then show -->
</div>
<div class="event">
<div class="header">Event 2</div>
<div class="youtube" style="display: none">More youtube clips</div>
</div>
</div>
</div>
当前 JS:
$("#panel_items").scrollable({
onBeforeSeek: function() { console.log("hide .child .youtube"); },
onSeek: function() { console.log("Show child .youtube"); }
});
额外问题:如何自动设置 #panel_items
的高度以匹配当前面板高度 (.event
)?
I'm scrolling some panels which contain some YouTube clips using jQuery Tools Scrollable. I'd like to hide them during the transition to avoid a jerky animation.
Markup:
<div id="panel_items">
<div id="wrap">
<div class="event">
<div class="header">Event 1</div><!-- Header is always displayed -->
<div class="youtube">youtube clips</div><!-- hide during transition, then show -->
</div>
<div class="event">
<div class="header">Event 2</div>
<div class="youtube" style="display: none">More youtube clips</div>
</div>
</div>
</div>
Current JS:
$("#panel_items").scrollable({
onBeforeSeek: function() { console.log("hide .child .youtube"); },
onSeek: function() { console.log("Show child .youtube"); }
});
Bonus question: How can I automatically set the height of #panel_items
to match the current panel height (.event
)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
像这样的东西可能会起作用(未经测试):
Something like this might work (untested):
你有这样尝试过吗? :
Did you try it like that? :
淡入和淡出会导致计数中断。经过一些测试,这有效:
fadein and fadeout throws off the count. After some testing, this works: