链接无法在水平菜单中工作

时间:2012-04-11 12:11:12

标签: jquery html css

使用JQuery添加自动滑块后,我的水平链接无法正常工作 aerospaceautomotive除外。添加更多超链接,因为我的声誉无法发布更多href链接。

以下是我的jquery代码:

function slideSwitch() {
var $active = $('#slideshow IMG.active');

if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
var $next =  $active.next().length ? $active.next()
    : $('#slideshow IMG:first');
var $sibs  = $active.siblings();
var rndNum = Math.floor(Math.random() * $sibs.length );
var $next  = $( $sibs[ rndNum ] );
$active.addClass('last-active');
$next.css({opacity: 0.0})
    .addClass('active')
    .animate({opacity: 1.0}, 1000, function() {
        $active.removeClass('active last-active');
    });
}

$(function() {
setInterval( "slideSwitch()", 5000 );
}); 

HTML:

<div id="hori">
   <ul>
      <li><a href="/home/adapco/Desktop/ksa1" target="name">Aerospace</a></li>
      <li><a href="/home/adapco/Desktop/ksa2.css" target="name">Automotive</a></li>
   </ul>
</div>

的CSS:

#slideshow
{
position:relative;
height:500px;
right:-570px;
top:-350px
}

#slideshow img
{
position:absolute;
top:0;
left:0;
z-index:8;
}

#slideshow img.active
{
z-index:10;
}

#slideshow img.last-active
{
z-index:9;
}

点击此链接http://jsfiddle.net/KyRus/20/

1 个答案:

答案 0 :(得分:0)

你有一个id为“幻灯片”的div,其中包含一些图像。 这个DIV是菜单链接的绝对ONTOP - 因此你无法按下链接。因此,您需要将幻灯片定位设置为不同,或者使菜单位置也是绝对的。

希望有所帮助:)