3

我正在使用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)?

4

3 回答 3

1

Did you try it like that? :

var api = jQuery("#panel_items").data("scrollable");

api.onBeforeSeek(function() {

    jQuery(". youtube").fadeOut(100);

});
于 2011-08-10T20:53:26.193 回答
1

像这样的东西可能有效(未经测试):

$("#panel_items").scrollable({
   onBeforeSeek: function() { this.getItems().css({'visibility': 'hidden'}); }, 
   onSeek: function() { this.getItems().css({'visibility': 'visible'});}
});  
于 2011-06-14T15:16:26.770 回答
0

淡入淡出和淡出使计数无效。经过一些测试,这有效:

onBeforeSeek: function (e,i) {
    $(".items").animate({opacity:0},400);
},
onSeek: function (e,i) {
    $(".items").animate({opacity:1},400);
}
于 2012-09-05T15:30:02.027 回答