jQuery 工具可滚动,动态改变高度

发布于 2024-09-07 01:08:51 字数 172 浏览 1 评论 0原文

我的页面中有一个可滚动的 div。容器 div 将其最小高度设置为某个值。我希望可滚动的项目可以显示/隐藏。这意味着可滚动的高度不固定。当显示该项目时,可滚动的高度也应该变为更长。但这是行不通的。当显示项目时,可滚动条不会变长,这使得显示的项目不完全显示。

我认为这与可滚动插件有关。但我不明白为什么。有人帮忙吗?

I have a scrollable div in my page. The container div has its min-height set to some value. And I want the item in the scrollable can be shown/hidden. It means that the height of the scrollable is not fixed. When the item is shown, the height of the scrollable should also change to longer. But this is not working. When the item is shown, the scrollable does not become longer which makes the shown item not completely shown.

I think it has something to do with the scrollable plugin. But I cannot figure out why. Anyone help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼眸 2024-09-14 01:08:51

使用可滚动事件

示例

$("#flowpanes").scrollable({ 
    circular: true, 
    mousewheel: false, 
    onBeforeSeek: function(evt, index){
        $('#flowpanes').stop().animate({ height: $('.item').eq(index+1).height()+'px'}, 250);
    }
})

您需要向索引添加 1,因为可滚动会克隆第一个和最后一个项目。

Use scrollable Events

Example

$("#flowpanes").scrollable({ 
    circular: true, 
    mousewheel: false, 
    onBeforeSeek: function(evt, index){
        $('#flowpanes').stop().animate({ height: $('.item').eq(index+1).height()+'px'}, 250);
    }
})

You need to add 1 to index because Scrollable clones the fist and last item.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文