简体   繁体   中英

Using jQuery to animate the visibility of a div when clicking navigation link

I'm new to jQuery and I currently have a jQuery function that drops a div from a hidden position when you click on a div box. this works fine with a css div as parameter, but when I try to parse two navigation links as parameters it doesn't work.

Anybody know what I'm doing wrong?

I want to replace .logobox with a <a href> link.

<script type="text/javascript">
$(document).ready(function(){
    $('.logoBox').toggle(function(){
        $('.lowerContainer').slideDown();
    }, function(){
        $('.lowerContainer').slideUp();
    });
});
</script>

This is the code snippet that's not working:

<script type="text/javascript"> $(document).ready(function(){ $('<a href="C:\\Users\\home.html">Home</a>').toggle(function(){ $('.lowerContainer').slideDown(); }, function(){ $('.lowerContainer').slideUp(); }); }); </script>

try this

<script type="text/javascript">
 $(document).ready(function(){
  $('.logoBox').mouseenter(function(){
    $('.lowerContainer').slideDown();
  });
  $('.logoBox').mouseleave(function(){
     $('.lowerContainer').slideUp();
  });
 });
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM