jquery 水平子导航
我正在使用下面的脚本作为翻转时的子导航,效果很好,但我想做一件事,那就是在某个页面上我希望它可见!
换句话说,主页您翻转并显示子导航,然后当您单击具有子导航的内容页面时,子导航意味着始终显示可见,并且上方子导航显示在滚动的顶部......如果那样制作场景?
$(document).ready(function() {
$("ul#topnav li").hover(function() { //Hover over event on list item
$(this).find("div").show(); //Show the subnav
} , function() { //on hover out...
$(this).css({ 'background' : 'none'}); //Ditch the background
$(this).find("div").hide(); //Hide the subnav
});
});
iv 制作页面的方式是使用包含文件(inc.mainnav.php),
我正在考虑使用像 .find.attr(class).cur 这样的东西。cur 是当前的导航页面。 但js不太好...
希望有人能帮忙???
Am using the script below for a sub nav on rollover which works fine but there is one thing i wold like to do and that is on a certain page i would like it to be visible!
in other words home page you rollover and sub nav is shown then when you click to a content page which has a subnav the sub nav mean is be visible always shown and the over subnav are shown over the top on rolover.... if that makes scenes?
$(document).ready(function() {
$("ul#topnav li").hover(function() { //Hover over event on list item
$(this).find("div").show(); //Show the subnav
} , function() { //on hover out...
$(this).css({ 'background' : 'none'}); //Ditch the background
$(this).find("div").hide(); //Hide the subnav
});
});
the way iv made the pages is using a include file (inc.mainnav.php)
i was thinking of using somethink like .find.attr(class).cur .cur is the current nav page.
but js is not that good...
hope some one can help ???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
给你当前/活动的选项卡一个类
并且只有一个 css 规则,因为
最好用 css 而不是 JS 来完成它
Give your current/active tab a class
<li class="active">
and just have a css rule forit would be best to do it in css rather than JS