旋转 JQuery UI 选项卡
一个小时以来一直试图解决这个问题,但没有成功。
我已经设置了选项卡并且它们正在旋转,但所选选项卡不会使用 z-index 升到上方,但它不起作用。我以前使用过 ui 选项卡,但从未旋转过。这是代码:
CSS:
#featured {
height: 200px;
position: relative;
width: 310px;
}
#featured ul.ui-tabs-nav {
left: 365px;
list-style: none outside none;
margin: 0;
padding: 0;
position: absolute;
top: 0;
width: 180px;
}
#featured ul.ui-tabs-nav li {
color: #FFFFFF;
font-size: 12px;
}
#featured .ui-tabs-panel {
height: 186px;
overflow: hidden;
position: relative;
width: 380px;
z-index: 0;
}
#featured .ui-tabs-hide{
display:none;
}
#featured li.ui-tabs-nav-item a {
background: none repeat scroll 0 0 #FFFFFF;
display: block;
height: 57px;
line-height: 15px;
outline: medium none;
}
#featured li.ui-tabs-nav-item a:hover{
z-index: 999;
}
#featured li.ui-tabs-selected{ /*Selected tab style*/
z-index: 999;
}
#featured ul.ui-tabs-nav li.ui-tabs-selected a{
z-index: 999;
}
HTML:
<div id="featured" >
<ul class="ui-tabs-nav">
<li class="ui-tabs-nav-item ui-tabs-selected" id="nav-fragment-1"><a href="#fragment-1"><img src="http://localhost/devilishkiss/images/featured/menu1.png" /></a></li>
<li class="ui-tabs-nav-item" id="nav-fragment-2"><a href="#fragment-2"><img src="http://localhost/devilishkiss/images/featured/menu2.png" /></a></li>
<li class="ui-tabs-nav-item" id="nav-fragment-4"><a href="#fragment-4"><img src="http://localhost/devilishkiss/images/featured/menu3.png" /></a></li>
</ul>
<!-- First Content -->
<div id="fragment-1" class="ui-tabs-panel" style="">
<a href="http://www.lulu.com/content/466605"><img src="http://localhost/devilishkiss/images/featured/stuk.png" /></a>
</div>
<!-- Second Content -->
<div id="fragment-2" class="ui-tabs-panel ui-tabs-hide" style="">
<a href="http://www.lulu.com/content/466605"><img src="http://localhost/devilishkiss/images/featured/jrabbit2011.png" /></a>
</div>
<!-- Fourth Content -->
<div id="fragment-4" class="ui-tabs-panel ui-tabs-hide" style="">
<a href="http://www.lulu.com/content/466605"><img src="http://localhost/devilishkiss/images/featured/fg_feat.png" /></a>
</div>
</div>
JQuery:
<script language="javascript" type="text/javascript">
$(document).ready(function(){
$("#featured > ul").tabs({fx:{opacity: "show"}}).tabs("rotate", 3000);
});
</script>
所以只是为了澄清选项卡具有部分隐藏的图像。当选择选项卡时,我希望选项卡升至所有内容的顶部以显示完整图像。
感谢所有帮助 谢谢 乔
Been trying to fix this for an hour, no luck.
I have set the tabs up and they are rotating but the selected tab will not raise above using z-index but it wont work. I have used the ui tabs before but never rotating. Here is the code:
CSS:
#featured {
height: 200px;
position: relative;
width: 310px;
}
#featured ul.ui-tabs-nav {
left: 365px;
list-style: none outside none;
margin: 0;
padding: 0;
position: absolute;
top: 0;
width: 180px;
}
#featured ul.ui-tabs-nav li {
color: #FFFFFF;
font-size: 12px;
}
#featured .ui-tabs-panel {
height: 186px;
overflow: hidden;
position: relative;
width: 380px;
z-index: 0;
}
#featured .ui-tabs-hide{
display:none;
}
#featured li.ui-tabs-nav-item a {
background: none repeat scroll 0 0 #FFFFFF;
display: block;
height: 57px;
line-height: 15px;
outline: medium none;
}
#featured li.ui-tabs-nav-item a:hover{
z-index: 999;
}
#featured li.ui-tabs-selected{ /*Selected tab style*/
z-index: 999;
}
#featured ul.ui-tabs-nav li.ui-tabs-selected a{
z-index: 999;
}
HTML:
<div id="featured" >
<ul class="ui-tabs-nav">
<li class="ui-tabs-nav-item ui-tabs-selected" id="nav-fragment-1"><a href="#fragment-1"><img src="http://localhost/devilishkiss/images/featured/menu1.png" /></a></li>
<li class="ui-tabs-nav-item" id="nav-fragment-2"><a href="#fragment-2"><img src="http://localhost/devilishkiss/images/featured/menu2.png" /></a></li>
<li class="ui-tabs-nav-item" id="nav-fragment-4"><a href="#fragment-4"><img src="http://localhost/devilishkiss/images/featured/menu3.png" /></a></li>
</ul>
<!-- First Content -->
<div id="fragment-1" class="ui-tabs-panel" style="">
<a href="http://www.lulu.com/content/466605"><img src="http://localhost/devilishkiss/images/featured/stuk.png" /></a>
</div>
<!-- Second Content -->
<div id="fragment-2" class="ui-tabs-panel ui-tabs-hide" style="">
<a href="http://www.lulu.com/content/466605"><img src="http://localhost/devilishkiss/images/featured/jrabbit2011.png" /></a>
</div>
<!-- Fourth Content -->
<div id="fragment-4" class="ui-tabs-panel ui-tabs-hide" style="">
<a href="http://www.lulu.com/content/466605"><img src="http://localhost/devilishkiss/images/featured/fg_feat.png" /></a>
</div>
</div>
JQuery:
<script language="javascript" type="text/javascript">
$(document).ready(function(){
$("#featured > ul").tabs({fx:{opacity: "show"}}).tabs("rotate", 3000);
});
</script>
So just to clarify the tabs have images that are partially hidden. when the tab is slected I want the tab to raise to the top of everything to show the full image.
All help appreciated
Thanks
Joe
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我正在使用同样的方法。由于所选类对列表项进行样式设置,因此从技术上讲,列表项将始终位于其内容的后面。我们的网站将其与小缩略图和底部流行的“圆形”缩略图一起使用。对于圆圈,我确保所选的类级联在列表项下方(基本上,确保所选的项目类与常规背景图像重叠)。而且,这对我有用,使所选图像与我放在 LI 标签上的常规图像重叠。 (我使用的是图像精灵,因此第一个图像是文件中位置 0 0 处的灰点,第二个图像是一个蓝点,出现在文件中向下 19 个像素的位置。
这是代码的顺序我' m 在 CSS 中使用(我们的网站上已经有大量其他代码来设置此样式......这只是覆盖)。
I'm using this same approach. Because the selected class styles the list item, technically the list item will always sit behind it's contents. Our website uses this with both small thumbnail images and the popular "circle" thumbnails at the bottom. For the circles, I made sure the selected class cascaded below the list item (basically, making sure the selected item class overlapped the regular background image). And, this worked for me to get the selected image to overlap the regular image I'm putting on the LI tag. (I'm using an image sprite, so the first image is a grey dot at position 0 0 in the file, and the second image, a blue dot, appears 19 pixels down in the file.
Here's the order of the code I'm using in the CSS. (There's a ton of other code already in place on our site to style this... this is only the override).
我发现的一个错误是
$("#featured > ul").tabs
。试试这个:另一种是删除选项卡的所有类:
请参阅此处的演示: http://jsbin.com /uquyo3/
One mistake I spot is
$("#featured > ul").tabs
. Try this:Another one is that, remove all the classes for the tabs:
See the demo here: http://jsbin.com/uquyo3/