Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
329 views
in Technique[技术] by (71.8m points)

jquery - Can't get dropotron script to work properly [HTML/CSS/JavaScript]

I asked a previous question about creating a dropdown menu on my webpage similar to a template. I figured out that the template was using dropotron to create this menu. I downloaded dropotron and attempted to follow the instructions it provided.

Here's my website, and here's the example that shows a working dropotron script.

Here's a codepen link to the HTML, CSS, and JavaScript: codepen.io/anon/pen/EPaYNz

What's odd is that it works in codepen result, but I'm not sure why it's buggy on my site. I copied the HTML, CSS, and JavaScript files exactly.

Any thoughts?

Thanks!

EDIT: another misc bug I found on the codepen result was when I hover over "Biography" in the submenu, "Who I Am" disappears. Any way to fix this, too?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

For formatting purposes I'm putting this as an answer. Your scripts should look like this at the bottom and there should be no scripts in the head:

<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/jquery.poptrox.min.js"></script>
<script src="assets/js/jquery.scrolly.min.js"></script>
<script src="assets/js/jquery.scrollex.min.js"></script>
<script src="assets/js/skel.min.js"></script>
<script src="assets/js/util.js"></script>
<!--[if lte IE 8]><script src="assets/js/ie/respond.min.js"></script><![endif]-->
<script src="assets/js/jquery.dropotron.js"></script>
<script>
  $(function() {

    // Note: make sure you call dropotron on the top level <ul>
    $('#nav > ul').dropotron({ 
      offsetY: -10 // Nudge up submenus by 10px to account for padding
    });

  });
</script>
<script src="assets/js/main.js"></script>

By the way, your <--[if lte blah] didn't have the closing angle bracket > all the way at the end


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...