[英]Bootstrap menu links not clickable
I'm using a bootstrap theme, and i kind of edited it to my needs. 我正在使用引导程序主题,并根据需要对其进行了某种编辑。 Internal links (on the same page) are working, but external links are not clickable with the left mouse button.
内部链接(在同一页面上)正在工作,但是外部链接无法用鼠标左键单击。 When i right click and open a link in a different tab it does work.
当我右键单击并在其他选项卡中打开链接时,它确实起作用。 I have no clue on what i did wrong, as i have not massively destroyed the code, just edited it to my needs( link ).
我不知道我做错了什么,因为我还没有大规模销毁代码,只是根据我的需要对其进行了编辑( link )。
<li><a href="#body">Home</a></li>
<li><a href="#info">information</a></li>
<li><a href="#server">Server</a></li>
<li><a href="#packages">packages</a></li>
<li><a href="//xxxxx">forum</a></li>
<li><a href="//xxxxx/">Donate</a></li>
the links with a # infront of them do work but externals do not. 前面带有#个的链接有效,但外部外观无效。
Anyone has any idea on how to fix this? 有人对如何解决这个问题有任何想法吗?
As you are using singlePageNav()
function you just need to add external
class to external link. 当您使用
singlePageNav()
函数时,您只需要向外部链接添加external
类。
Updated HTML 更新的HTML
<li><a href="#body" class="current">Home</a></li>
<li><a href="#info" class="">information</a></li>
<li><a href="#server" class="">Server</a></li>
<li><a href="#packages" class="">packages</a></li>
<li><a href="http://forum.lvcnr.org/forum.php" class="external">forum</a></li>
<li><a href="http://donate.lvcnr.org/" class="external">Donate</a></li>
Hope this will work. 希望这会起作用。
For more info here is an example of same single-page-nav plugin. 有关更多信息,这里是相同的单页导航插件的示例 。
you have a click handler somewhere that has code that is preventing the click from working. 您在某处有一个单击处理程序,该处理程序的代码阻止了该单击操作。 I am guessing that this is the evil line , I really don't know fr sure I didn't go through all your js files:
我猜这是罪魁祸首,我真的不知道我没有遍历所有js文件:
jQuery('#nav').singlePageNav({
I don't know what singlePageNav()
does , but I'd be willing to bet that is probably the root cause 我不知道
singlePageNav()
作用,但我愿意打赌这可能是根本原因
I'm not going to search through your entire code to find it , but I do know for sure that is what is going on. 我不会在整个代码中进行搜索以找到它,但是我确实知道这是怎么回事。 If you go into the console and type this:
如果您进入控制台并输入以下内容:
$('#nav li a').off('click');
then the links go back to working like normal. 然后链接恢复正常工作。
This goes back to my original comment that there is nothing at all wrong here , there is something else going on. 这可以追溯到我最初的评论,即这里没有任何错误,还有其他情况。 In this case you have some other code off somewhere else targeting these links preventing them from working.
在这种情况下,您需要在其他地方针对这些链接设置一些其他代码,以防止它们工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.