如何使用jQuery在Smooth Animated Menu中创建出站链接?

时间:2011-01-13 23:10:54

标签: jquery-selectors hyperlink jquery-animate

我在One Mighty Roar使用Zach非常酷的jquery下拉菜单。我不能把它链接到一个新窗口中的Facebook页面。 js文件如下:

$(document).ready(function(){

//Remove outline from links
$("a").click(function(){
$(this).blur();
});

//When mouse rolls over
$("li").mouseover(function(){
$(this).stop().animate({height:'150px'},{queue:false, duration:600, easing: 'easeOutBounce'})
});

//When mouse is removed
$("li").mouseout(function(){
$(this).stop().animate({height:'50px'},{queue:false, duration:600, easing: 'easeOutBounce'})
});

});

html如下:

<div id="nav">
<ul class="tabNav">
<li><a href="#tab=5"><img src="../images/facebook.png" alt="Check out our Facebook page!" width="36" height="36" border="0" /></a></li>
<li><a href="#tab=4">FTP Site</a></li>
<li><a href="#tab=3">Contact</a></li>
<li><a href="#tab=2">Services</a></li>
<li class="current"><a href="#tab=1">Projects</a></li>
</ul>

<div class="tabContainer">
<div class="tab"><p><a href="http://www.facebook.com" target="_blank">Click here to be taken to our Facebook page.</a></p></div>
<div class="tab"><p>Click here to be taken to our ftp site to download your documents.</p></div>
<div class="tab">Contact Info</div>
<div class="tab">Services Info</div>
<div class="tab current">Projects Info</div>
</div>

css:

/* MENU */

ul.tabNav {
    list-style: none;
    width: 100%;
    float: left;
}
ul.tabNav li {
    float: right;
    margin: 0;
}
.tab.current ul li {
    list-style-type: none;
    margin-left: 15px;
    line-height: 1.5em;
}
.tabNav li a img {
    margin-top: 15px;
}
ul.tabNav li.current {

}
ul.tabNav a {
    color: #FFF;
    display: block;
    height: 66px;
    padding: 10px;
    text-decoration: none;
    width: 66px;
    margin-left: 4px;
    font-size: 16px;
    border: 1px solid #FF9933;
    text-align: center;
    font-weight: normal;
    text-transform: lowercase;
    font-family: "Century Gothic";
    letter-spacing: 1px;
    line-height: 60px;
}
ul.tabNav li.current a {
    padding: 10px;
}
div.tabContainer {
    clear: both;
    float: right;
    width: 500px;
    z-index: 9999;
}
div.tabContainer div.tab {
    border: 1px solid #FF9933;
    color: #FFF;
    display: none;
    padding: 10px;
    background-image: url(images/slideshow_bg.png);
    background-repeat: repeat;
    margin-top: 14px;
    height: 500px;
}
div.tab p:last-child { margin-bottom: 0; }
.tabContainer .tab { display: none; }

我尝试在http://和/或tabNav部分添加我的tabContainer,但我无法链接。令人沮丧。

1 个答案:

答案 0 :(得分:1)

你试过了吗?

<a href="#" onclick="window.open('http://www.facebook.com')">Click here to be taken to our Facebook page.</a>

您还可以设置其他属性。在此处查看文档和示例:http://www.w3schools.com/jsref/met_win_open.asp