旋转 JQuery UI 选项卡

发布于 2024-10-26 14:20:38 字数 2857 浏览 2 评论 0原文

一个小时以来一直试图解决这个问题,但没有成功。

我已经设置了选项卡并且它们正在旋转,但所选选项卡不会使用 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 技术交流群。

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

发布评论

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

评论(2

¢好甜 2024-11-02 14:20:38

我正在使用同样的方法。由于所选类对列表项进行样式设置,因此从技术上讲,列表项将始终位于其内容的后面。我们的网站将其与小缩略图和底部流行的“圆形”缩略图一起使用。对于圆圈,我确保所选的类级联在列表项下方(基本上,确保所选的项目类与常规背景图像重叠)。而且,这对我有用,使所选图像与我放在 LI 标签上的常规图像重叠。 (我使用的是图像精灵,因此第一个图像是文件中位置 0 0 处的灰点,第二个图像是一个蓝点,出现在文件中向下 19 个像素的位置。

这是代码的顺序我' m 在 CSS 中使用(我们的网站上已经有大量其他代码来设置此样式......这只是覆盖)。

#featured ul.circle li.ui-tabs-nav-item {
    background: url('../images/site/selected-item-circle.png') 0 0 no-repeat !important; 
    height:18px;
    width:18px;
    float:left;
    margin:0 0 0 7px;
}
#featured ul.circle li.ui-tabs-selected { 
    background:url('../images/site/selected-item-circle.png') 0 -19px no-repeat !important; 
    width:18px;
    height:18px;
    float: left;
    margin:0 0 0 7px;
}

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.circle li.ui-tabs-nav-item {
    background: url('../images/site/selected-item-circle.png') 0 0 no-repeat !important; 
    height:18px;
    width:18px;
    float:left;
    margin:0 0 0 7px;
}
#featured ul.circle li.ui-tabs-selected { 
    background:url('../images/site/selected-item-circle.png') 0 -19px no-repeat !important; 
    width:18px;
    height:18px;
    float: left;
    margin:0 0 0 7px;
}
温柔嚣张 2024-11-02 14:20:38

我发现的一个错误是 $("#featured > ul").tabs。试试这个:

$("#featured").tabs({fx:{opacity: "show"}}).tabs("rotate", 3000);

另一种是删除选项卡的所有类:

<div id="tabs">
    <ul>
        <li><a href="#tabs-1">tab 1</a></li>
        <li><a href="#tabs-2">tab 2</a></li>
        <li><a href="#tabs-3">tab 3</a></li>
    </ul>

    <div id="tabs-1">
        content 1
    </div>

    <div id="tabs-2">
        content 2
    </div>
    <div id="tabs-3">
        content 3
    </div>

</div>

请参阅此处的演示: http://jsbin.com /uquyo3/

One mistake I spot is $("#featured > ul").tabs. Try this:

$("#featured").tabs({fx:{opacity: "show"}}).tabs("rotate", 3000);

Another one is that, remove all the classes for the tabs:

<div id="tabs">
    <ul>
        <li><a href="#tabs-1">tab 1</a></li>
        <li><a href="#tabs-2">tab 2</a></li>
        <li><a href="#tabs-3">tab 3</a></li>
    </ul>

    <div id="tabs-1">
        content 1
    </div>

    <div id="tabs-2">
        content 2
    </div>
    <div id="tabs-3">
        content 3
    </div>

</div>

See the demo here: http://jsbin.com/uquyo3/

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