我可以创建内容高度可变的尾部滑块导航吗?

发布于 2024-07-17 14:22:25 字数 518 浏览 7 评论 0原文

如今,大多数人都非常了解 Coda Slider 效果,但即使通过谷歌搜索并在这里进行搜索,我也找不到答案。

问题 如何创建一个使用水平滑动/滚动的 Coda Slider 样式导航,在滑动动画期间将其高度调整为内容所需的高度?

例如,第一张“幻灯片”中只有一张图片(宽度为 400 像素,高度为 300 像素),但下一张幻灯片包含大量信息,包括图片、文本和视频内容,总计宽度为 400 像素,高度为 800 像素。 现在,首先创建一个 800 像素高的容器只是浪费幻灯片 1 的空间,因此我需要根据单个幻灯片内容所需的高度动态更改幻灯片容器的高度。

这可能吗? 也许那里有一个教程,你们中的一个可以向我指出这一点。

在技​​术方面,我对xHTML和CSS非常适应,但对jQuery和PHP只是业余爱好者。 虽然这不应该限制您的答案,但请在解释时牢记这一点。

非常感谢您的阅读, 我期待您的想法、解决方案和一般意见。

詹尼斯

Most people know the Coda Slider effect well these days but even with googling and doing a search here I could not find my answer.

Question How can I create a Coda Slider style navigation that uses horizontal sliding/scrolling but adaptes its height during the sliding animation to the height needed for the content?

For instance, the first 'slide' only has a picture in it (400px width, 300px height) but the next slide has lots of info including pictures, text and video content totalling at 400px width and 800px in height.
Now, creating a 800px high container to begin with is just a waste of space for slide 1 so i need to dynamically based upon the height needed by the content of the individual slide change the height of the slide's container.

Is this possible?
Maybe there is a tutorial somewhere out there and one of yous could point me towards that.

In terms of technology I am quite adapt at xHTML and CSS but only an amateur at jQuery and PHP.
While this should not be a restriction to your answer, please keep it in mind when explaining things.

Thank you very much for reading,
I look forward to your ideas, solution and general input.

Jannis

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

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

发布评论

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

评论(1

拥有 2024-07-24 14:22:25

我最近推出了自己的。 这是(希望)一个有用的起点。

这是我的“下一步按钮”的代码。

var canSlide = true;
$('.next').bind('click', function() {



            if (!canSlide) { return false } // prevent queuing up of multiple clicks

            $('.prev').fadeIn(500);

            canSlide = false;

            $('.testimonials-container').animate({ left: '-=1011px' }, 1000, function() { canSlide = true });            

            if (currentPane == totalPanes) {

                $('.next').fadeOut(500);
                canScroll = false;

            } else {
                currentPane++;


            }

要让它调整高度,您只需向动画的 JSON 参数添加高度即可。 当然

.animate({left: '-=1011px', height: newHeight + 'px'})

,您需要一些 JavaScript 来计算出下一个高度应该是多少!

I recently rolled my own. Here is (hopefully) a useful starting point.

Here is the code for my 'next button'.

var canSlide = true;
$('.next').bind('click', function() {



            if (!canSlide) { return false } // prevent queuing up of multiple clicks

            $('.prev').fadeIn(500);

            canSlide = false;

            $('.testimonials-container').animate({ left: '-=1011px' }, 1000, function() { canSlide = true });            

            if (currentPane == totalPanes) {

                $('.next').fadeOut(500);
                canScroll = false;

            } else {
                currentPane++;


            }

To get it to adjust it's height, you'd simply add a height to the animate's JSON argument. Such as

.animate({left: '-=1011px', height: newHeight + 'px'})

And of course, you'll need some JavaScript to work out what the next height should be!

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