Вопрос

a newbie here. i have a menu, which using a jQuery slide effect. I want to integrate with hoverIntent. I try to include the file, but still didnt work. Can you guys help me? :)

<ul id="nav">
    <li><a href="1.html" id="CorporateMenu">Corporate Profile</a>

        <ul>
            <li><a href="#">Vision &amp; Mission</a>
            </li>
            <li><a href="#">Board of Director</a>
            </li>
            <li><a href="#">Senior Management</a>
            </li>
            <li><a href="#">Group Companies</a>
            </li>
        </ul>
    </li>
    <li><a href="index.html" id="HomeMenu">Home</a>
    </li>
</ul>
<!-- menu dropdown animated -->
<script type="text/javascript">
    $(document).ready(function() {
        $('#nav li').hover(function() {
            $('ul', this).slideDown(250);
            $(this).children('a:first').addClass("hov");
        }, function() {
            $('ul', this).slideUp(150);
            $(this).children('a:first').removeClass("hov");
        });
    });
</script>
Это было полезно?

Решение

It sounds like you are using the hoverIntent plugin. If that's true use .hoverIntent instead of .hover as event.

Fiddle: http://jsfiddle.net/HbjuW/

$(document).ready(function() {   
  $('#nav li').has('ul').hoverIntent({
    over: function() {
      $('ul', this).slideDown(250);
      $(this).children('a:first').addClass("hov");
    },
    timeout: 500,
    out: function() {
      $('ul', this).slideUp(150);
      $(this).children('a:first').removeClass("hov");
    }
  });
});
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top