jCarousel 图像不显示在 jQuery 滑块中

发布于 2024-09-28 04:04:01 字数 539 浏览 2 评论 0原文

我有一个 jQuery 滑动面板,其中未显示 jQuery 轮播。

示例:http://www.warface.co.uk/clients/warface。 co.uk/

单击显示仪表板以显示滑动面板。

我显示了按钮(上一个/下一个),但没有显示轮播。例如,我也添加了下面的轮播。

我有滑动面板的 CSS

#panel {
    width: 100%;
    height: 500px;
    color: #999999;
    background: #272727;
    overflow: hidden;
    position: relative;
    z-index: 3;
    display: none;
}

,似乎删除了 display: none; 修复了它,但在页面加载时使滑块向下。

I have a jQuery sliding panel that is not displaying a jQuery carousel within it.

Example: http://www.warface.co.uk/clients/warface.co.uk/

Click Show Dashboard to display the Sliding Panel.

I have the buttons (previous/next) displaying but not the carousel. I have added the carousel below also for example.

I have the CSS for the sliding panel

#panel {
    width: 100%;
    height: 500px;
    color: #999999;
    background: #272727;
    overflow: hidden;
    position: relative;
    z-index: 3;
    display: none;
}

and it seems removing display: none; fixes it but leaves the slider down on page load.

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

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

发布评论

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

评论(1

ゃ懵逼小萝莉 2024-10-05 04:04:01

破解它:

您需要使用高度而不是显示来隐藏面板,如下所示:

#panel {
    width: 100%;
    height:0px;
    color: #999999;
    background: #272727;
    overflow: hidden;
    position: relative;
    z-index: 3;
    }

然后通过将高度更改为 500 使您的 JS 在 js 中显示它,使您的 JS 如下:

$(document).ready(function() {

    // Expand Panel
   $("#open").click(function(e){
       e.preventDefault();
        $("div#panel").animate({height: "500px"},"slow");
    });    

    // Collapse Panel
    $("#close").click(function(e){
        e.preventDefault();
        $("div#panel").animate({height: "0px"},"slow");
    });     

    // Switch buttons from "Log In | Register" to "Close Panel" on click
    $("#toggle a").click(function () {
        $("#toggle a").toggle();
    });  

     $(".anyClass").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev"
    });

});

注意附加的 PreventDefault() ,它可以防止页面跳转到顶部,当我在 jsfiddle 中尝试它时,这是必要的,但在实时应用程序中可能不需要,尽管如此,这通常是很好的做法。如果您想查看它的实际效果,可以在这里进行:http://jsfiddle.net/LiamBailey/ ERQzd/87/ 注意:由于 jsfiddle 中的窗口大小有限,您必须向下滚动才能到达关闭面板链接,从而导致您无法看到面板向上滑动,因为 PreventDefault,为了解决此问题,我添加了向上滚动一点 $("html,body").animate({scrollTop: target},"fast"); 但是您不需要这些,因为关闭面板链接在没有向下滚动。

Cracked it:

You need to hide your panel using height instead of display, like so:

#panel {
    width: 100%;
    height:0px;
    color: #999999;
    background: #272727;
    overflow: hidden;
    position: relative;
    z-index: 3;
    }

Then show it in js by changing height to 500 making your JS this:

$(document).ready(function() {

    // Expand Panel
   $("#open").click(function(e){
       e.preventDefault();
        $("div#panel").animate({height: "500px"},"slow");
    });    

    // Collapse Panel
    $("#close").click(function(e){
        e.preventDefault();
        $("div#panel").animate({height: "0px"},"slow");
    });     

    // Switch buttons from "Log In | Register" to "Close Panel" on click
    $("#toggle a").click(function () {
        $("#toggle a").toggle();
    });  

     $(".anyClass").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev"
    });

});

Note the additon of preventDefault() which prevents the page from jumping to the top, which was neccesary when I was trying it in jsfiddle, but prob won't be needed in live application, none the less it is generally good practice. If you want to see it in action you can do so here: http://jsfiddle.net/LiamBailey/ERQzd/87/ note: because of the limited window size in jsfiddle, you have to scroll down to get to the close panel link leaving you unable to see the panel sliding back up because of preventDefault, to fix this I added a little scroll up $("html,body").animate({scrollTop: target},"fast"); But none of that will be needed for you as the close panel link is visible without scrolling down.

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