-1

Could someone explain how to make delay for dropdown when mouse is out from #categories_block_top .tree ul ? Sorry but I am newbie at jQuery. Here is the link - http://livedemo04.prestatrend.com/ and js-file fot the menu is treeManagementTop.js.

John Smith
  • 85
  • 1
  • 9
  • 2
    You should post some code in the question. Especially for future visitors, it's helpful to see the code here because the link you provided may not always be a stable source for it. – Purag Feb 20 '12 at 18:30

5 Answers5

1

If you used hoverIntent plugin and you got an error "makeTall is not defined", check if you added that function e.g. in the source of hoverIntent homepage it looks like:

<script type="text/javascript" charset="utf-8">
    $(document).ready(function(){
        $("#demo1 li").hover(makeTall,makeShort);
        $("#demo2 li").hoverIntent(makeTall,makeShort);
        $("#demo3 li").hoverIntent({
            over: makeTall, 
            timeout: 500, 
            out: makeShort
        });
    }); // close document.ready

    function makeTall(){  $(this).animate({"height":75},200);}
    function makeShort(){ $(this).animate({"height":50},200);}
</script>

But I did it another way without plugin:

 <ul id="elem">
<li><a href="#"><span>1</span></a>
<ul id="child" style="display:none;">
   <li ><a href="">Home</a></li>
       <li ><a href="">About</a></li>
       <li ><a href="">Contacts</a></li>
       <li ><a href="">FAQ</a></li>
</ul>
 </ul>

 <script type="text/javascript">
$(function(){
   $('#elem').mouseenter(function(){
    $('#ch').css('display', 'block');
   });
   $('#elem').mouseleave(function(){
    $('#ch').delay(800).fadeOut('slow');
   });
    });
 </script>

Hope this will help :)

0
jQueryElement.find('ul:first').stop(true,true).hide(100);
jQueryElement.find('ul:first').stop(true,true).slideUp(100);

These 2 lines: You can adjust the menu speed to be slower by increasing the 100 to a higher number.

Michael
  • 3,568
  • 3
  • 37
  • 50
0

Also to add a delay see these: Jquery - Delay mouseout event Fade out jQuery menu after delay

Community
  • 1
  • 1
Michael
  • 3,568
  • 3
  • 37
  • 50
0

Check out the jQuery hoverIntent plugin:

http://cherne.net/brian/resources/jquery.hoverIntent.html

Derek Hunziker
  • 12,996
  • 4
  • 57
  • 105
  • Just added this plugin but there is an error - makeTall is not defined What the problem? – John Smith Feb 20 '12 at 19:17
  • Sounds like you are missing one of the required functions. If you don't require the "makeTall" function, just pass it an empty function definition. This may help: http://stackoverflow.com/questions/2196429/plugging-in-jquery-hoverintent-for-sliding-panel – Derek Hunziker Feb 20 '12 at 20:22
0

You might check out the hoverIntent plugin lets you define some vars that help with mouseenter/out interactions: http://cherne.net/brian/resources/jquery.hoverIntent.html

Johan
  • 35,120
  • 54
  • 178
  • 293