更改我的手风琴菜单插件中的链接

时间:2014-10-23 15:10:04

标签: javascript jquery html css

无论如何,我可以更改此手风琴下拉菜单中的链接,以便从同一页面上的区域转到外部HTML页面。我尝试了很多不同的东西,但似乎不会失去我的风格。现在,它已设置为目录和指向同一页面上特定区域的链接。

这是代码。任何帮助将不胜感激。谢谢。 麦克

..................................
<body>
<div class="container">
  <div id="toc-holder" class="toc-holder">
    <a href="#" class="toc-link" id="toc-link"><span>▼</span> Table of Contents</a>
    <ul id="toc" class="toc">
      <li class="toc-h1"><a href="#section1">1. Loomings</a>
        <ul class="toc-sub closed">
          <li><a href="#section1-1">1.1 Call me Ishmael</a></li>
          <li><a href="#section1-2">1.2 Circumambulate</a></li>
        </ul>
      </li>
      <li class="toc-h1">
        <a href="#section2">2. The Carpet-Bag</a>
        <ul class="toc-sub closed">
          <li><a href="#section2-1">2.1 I stuffed a shirt</a></li>
          <li><a href="#section2-2">2.2 As most young candidates</a></li>
        </ul>
      </li>
      <li class="toc-h1">
        <a href="#section3">3. The Spouter-Inn</a>
        <ul class="toc-sub closed">
          <li><a href="#section3-1">3.1 Entering that gable-ended</a></li>
          <li><a href="#section3-2">3.2 But what most puzzled</a></li>
        </ul>
      </li>
      <li class="toc-h1">
        <a href="#section4">4. Counterpane</a>
        <ul class="toc-sub closed">
          <li><a href="#section4-1">4.1 Upon waking next morning about daylight...</a></li>
          <li><a href="#section4-2">4.2 My sensations were strange</a></li>
        </ul>
      </li>
      <li class="toc-h1">
        <a href="#section5">5. Breakfast</a>
        <ul class="toc-sub closed">
          <li><a href="#section5-1">5.1 I quickly followed suit</a></li>
          <li><a href="#section5-2">5.2 You could pretty plainly tell</a></li>
        </ul>
      </li>
      <li class="toc-h1">
        <a href="#section6">6. The Street</a>
        <ul class="toc-sub closed">
          <li><a href="#section6-1">6.1 If I had been astonished at first</a></li>
          <li><a href="#section6-2">6.2 But, besides the Feegeeans</a></li>
        </ul>
      </li>
    </ul>
  </div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="js/jquery.fixedTOC.js?v=3.0"></script>
<script>
// call the plugin on the "#toc" element
$('#toc').fixedTOC({
menuOpens: 'click', // or 'mouseenter'
scrollSpeed: 1000,
menuSpeed: 300,
useSubMenus: true,
resetSubMenus: true,
topLinkWorks: true
});
</script>
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1965499-1']);
_gaq.push(['_trackPageview']);

(function() {
  var ga = document.createElement('script');
  ga.type = 'text/javascript';
  ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(ga, s);
})();
</script></div>
</body>
........................................

1 个答案:

答案 0 :(得分:0)

您只需将href标记中的<a>更改为外部链接(而不是带有#(hashtags)的锚点)。 以下示例(或 JSFiddle ):

<li><a href="http://jimulle.com">1.1 Call me Ishmael</a></li>

*请注意,我们不知道<script src="js/jquery.fixedTOC.js?v=3.0"></script>是做什么的,如果这对您不起作用,您可能需要与我们分享此脚本