页面在IE中单击<a href>标记时跳转,jQuery附加到了href上

问题描述

|| 我有四个链接,其中href \指向通过
.load()
加载的页面的URL,问题出在IE中,当您单击它时页面会跳转,我在代码中附加了ѭ1并在IE中的所有浏览器中进行了修复。 我在代码上也有
return false
,所以它停止了默认行为。 我已经看到:Page跳到onclick顶部,并尝试实现答案,但是它似乎对我不起作用。 有人知道解决方案吗? href \的:
<a href=\"welcome.html\" name=\"welcome\">Welcome</a>
<a href=\"about.html\" name=\"about\">About</a>
<a href=\"forum.html\" name=\"forum\">Forum</a>
<a href=\"contact.html\" name=\"contact\">Contact</a>
jQuery代码:
    $(\'#jqNav li a\').click(function(e){

    if($(this).parent().is(\".nav1\")){ $(\'.landing .main .nav ul\').css({ \"background-position\" : \"0 -50px\" });} 
    else if($(this).parent().is(\".nav2\")) { $(\'.landing .main .nav ul\').css({ \"background-position\" : \"0 -100px\" });}
    else if($(this).parent().is(\".nav3\")) { $(\'.landing .main .nav ul\').css({ \"background-position\" : \"0 -150px\" });}
    else if($(this).parent().is(\".nav4\")) { $(\'.landing .main .nav ul\').css({ \"background-position\" : \"0 -200px\" });};

    stopAnim = true;
    $page = $(this).attr(\'href\');
    var $hashTag = $(this).attr(\'name\');
    window.location.hash = $hashTag;
    loadData();
    $(window).scrollTop(0);
    e.preventDefault();

});
    

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)