Jquery滑块;使容器透明,如何隐藏图像溢出?

时间:2014-06-29 04:15:30

标签: javascript jquery css jquery-ui-slider

此jquery滑块通常使用方形白框勾勒出来,这会隐藏图像溢出。我需要将滑块放在另一个图像的顶部,因此背景不能是白色的。我创建了一个具有透明背景的新.png文件。但是如何隐藏图像溢出?

非常感谢你;如果你看,你可以看到旧的#rotatescroll .overlay背景图片,我添加了第二个带有透明背景图像的#rotatescroll .overlay。

http://jsfiddle.net/QwLun/

HTML

<div id="rotatescroll">
    <div class="viewport">
        <ul class="overview">
            <li><a href="http://www.baijs.nl"><img src="https://raw.githubusercontent.com/wieringen/tinycircleslider/master/examples>/simple/images/hdr3.jpg" /></a>
            </li>
            <li><a href="http://www.baijs.nl"><img src="https://raw.githubusercontent.com/wieringen/tinycircleslider/master/examples/simple/images/hdr1.jpg" /></a>
            </li>
            <li><a href="http://www.baijs.nl"><img src="https://raw.githubusercontent.com/wieringen/tinycircleslider/master/examples/simple/images/hdr1.jpg" /></a>
            </li>
            <li><a href="http://www.baijs.nl"><img src="https://raw.githubusercontent.com/wieringen/tinycircleslider/master/examples/simple/images/hdr2.jpg" /></a>
            </li>
            <li><a href="http://www.baijs.nl"><img src="https://raw.githubusercontent.com/wieringen/tinycircleslider/master/examples/simple/images/hdr2.jpg" /></a>
            </li>
        </ul>
    </div>
    <div class="dot"></div>
    <div class="overlay"></div>
    <div class="thumb"></div>
</div>

CSS

img { border: 0; }


#rotatescroll { height:300px; position:relative; width:300px; }
#rotatescroll .viewport{ height:300px; position: relative; margin:0 auto; overflow:hidden; width:300px }
#rotatescroll .overview { position: absolute; width: 798px; list-style: none; margin: 0; padding: 0;  left: 0; top: 0; }
#rotatescroll .overview li { height:300px; width:300px; float: left; position: relative; }
#rotatescroll .thumb { background:url('http://baijs.com/tinycircleslider/images/bg-thumb.png') no-repeat 50% 50%; position: absolute; top: -3px; cursor: pointer; left: 137px; width: 100px; z-index: 200;  height: 100px; }
#rotatescroll .dot { background:url('http://baijs.com/tinycircleslider/images/bg-dot.png') no-repeat 0 0; display: none; height: 12px; width: 12px; position: absolute; left: 155px; top: 3px; z-index: 100; }
#rotatescroll .dot span { display: none; }

#rotatescroll .overlay {background:url('http://baijs.com/tinycircleslider/images/bg-rotatescroll.png') no-repeat 0 0; pointer-events: none; position: absolute; left: 0; top: 0; height:300px; width:300px; }

#rotatescroll .overlay {background:url('http://i.imgur.com/PtgjArP.png') no-repeat 0 0; pointer-events: none; position: absolute; left: 0; top: 0; height:300px; width:300px; }

.highlight, .indicator{background-color:#FC0;}

Jquery的

$('#rotatescroll').tinycircleslider({
                                     interval: true,
                                     dotsSnap: true,
                                 intervalTime: 1000
                                     });

1 个答案:

答案 0 :(得分:0)

在这种特殊情况下,由于视图是圆形的,我认为border-radius: 50%上的#rotatescroll .viewport就是你要找的。通过稍微调整,您可以删除轻微的轮廓。请参阅示例:http://jsfiddle.net/WKD32/