【问题标题】:Custom Fancybox v.2 title positioning自定义 Fancybox v.2 标题定位
【发布时间】:2013-01-14 20:35:58
【问题描述】:

试图将 Fancybox 标题放在图像的左侧。

您可以在http://www.josephfrederick.com 看到我能够破解 CSS 并移动标题,但 Fancybox 并未计算新宽度,因此灯箱未居中(而是位于中心左侧)。这会导致小屏幕上的水平图像出现大问题。

我可以在 Fancybox 1.4 版中做到这一点(比如这个网站:http://sarahewain.com/index.php),但在 Fancybox 2 中情况发生了变化。

感谢您提供的任何帮助。如果您需要其他任何建议,请告诉我。

这里是对应的 CSS ...

.fancybox-outer {
        background: white repeat scroll 0% 0%;
        text-shadow: none;
    margin-left:-180px; /*must match A*/
    border: 0px solid #000;
}

.fancybox-inner {
    position:relative;
    left:180px; /*must match A*/
}

.fancybox-image {
    padding-left:0px;
}

.fancybox-prev {
    top:30%;
    left:-220px;
    right:auto;
        width: 36px;
    height: 111px;
    background: url(images/arrow_prev.png) no-repeat scroll 0% 0%;
    opacity: 0.3;
    filter:alpha(opacity=30);
}

.fancybox-next {
    top:30%;
        width: 36px;
    height: 111px;
    left:auto;
    right:-38px;
    background: url(images/arrow_next.png) no-repeat scroll 0% 0%;
    opacity: 0.3;
    filter:alpha(opacity=30);
}

.fancybox-next:hover, .fancybox-prev:hover {
    opacity: 1.0;
    filter:alpha(opacity=100);
}

.fancybox-next span, .fancybox-next:hover span {
    display:none;
}

.fancybox-prev span, .fancybox-prev:hover span {
    display:none;
}

.fancybox-title {
    position:absolute;
    width:160px; /*must match B*/
    left:-160px; /*must match B*/
    bottom: 20px;
}

【问题讨论】:

    标签: jquery fancybox


    【解决方案1】:

    js

    jQuery(".my_class").fancybox({
    
      margin   : [0, 0, 0, 160],
    
        helpers : {
            title : {
                type : 'outside'
            }
        }
    });
    

    css

    .fancybox-title {
        position:absolute;
        width:160px;
        left:-160px;
        bottom: 20px;
    }
    

    【讨论】:

    • 稍微解释一下就好了。
    • with margin : [0, 0, 0, 160] 灯箱左侧有一个边距以放入标题。孔灯箱(包括标题)居中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-30
    相关资源
    最近更新 更多