2012-02-23 52 views
0

我在使用切換時可以正常工作,但我需要在鼠標懸停而不是點擊時打開這些菜單。jquery mouseover動畫

有問題的網頁: http://igs.link-networkonline.com/campaign-landing-page/

我的代碼:

$(function() { 
$("img.button1").toggle(function() { 
    $(".first").animate({'height': '295px', 'top': "-270px"}); 
    $("img.button1").animate({'top': "-235px"}); 
    $('img.button1').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png'); 
    $("body").animate({'padding-bottom': '-300px'}); 
}, function() { 
    $(".first").animate({'height': '75px', 'top': "-58px", 'overflow': "hidden"}); 
    $("img.button1").animate({'top': "-25px"}); 
    $('img.button1').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png'); 
}); 
    $("img.button2").toggle(function() { 
     $(".second").animate({'height': '285px', 'top': "-268px"}); 
     $("img.button2").animate({'top': "-240px"}); 
     $('img.button2').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png'); 
    }, function() { 
     $(".second").animate({'height': '75px', 'top': "-58px"}); 
     $("img.button2").animate({'top': "-25px"}); 
     $('img.button2').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png'); 
    }); 
$("img.button3").toggle(function() { 
    $(".third").animate({'height': '260px', 'top': "-243px"}); 
    $("img.button3").animate({'top': "-210px"}); 
    $('img.button3').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png'); 
}, function() { 
    $(".third").animate({'height': '75px', 'top': "-58px"}); 
    $("img.button3").animate({'top': "-25px"}); 
    $('img.button3').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png'); 
}); 

$(".first").toggle(function() { 
    $(".first").animate({'height': '295px', 'top': "-270px"}); 
    $("img.button1").animate({'top': "-235px"}); 
    $('img.button1').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png'); 
    $("body").animate({'padding-bottom': '-300px'}); 
}, function() { 
    $(".first").animate({'height': '75px', 'top': "-58px", 'overflow': "hidden"}); 
    $("img.button1").animate({'top': "-25px"}); 
    $('img.button1').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png'); 
}); 
    $(".second").toggle(function() { 
     $(".second").animate({'height': '285px', 'top': "-268px"}); 
     $("img.button2").animate({'top': "-240px"}); 
     $('img.button2').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png'); 
    }, function() { 
     $(".second").animate({'height': '75px', 'top': "-58px"}); 
     $("img.button2").animate({'top': "-25px"}); 
     $('img.button2').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png'); 
    }); 
    $(".third").toggle(function() { 
     $(".third").animate({'height': '260px', 'top': "-243px"}); 
     $("img.button3").animate({'top': "-210px"}); 
     $('img.button3').attr('src','<?php bloginfo('template_directory'); ?>/images/downarrow.png'); 
    }, function() { 
     $(".third").animate({'height': '75px', 'top': "-58px"}); 
     $("img.button3").animate({'top': "-25px"}); 
     $('img.button3').attr('src','<?php bloginfo('template_directory'); ?>/images/bluebutton.png'); 
    }); 

}); 

這已經花了我很多時間來獲得正常運行。我需要每個鼠標滑過鼠標,然後滑出鼠標。謝謝。 }); `

+0

我猜你想讓我們爲你做?你試過什麼了? – Bot 2012-02-23 17:45:39

+0

我試過使用懸停(功能(),但是當我實現它時,菜單繼續上下滑動,上面的鏈接更新顯示錯誤 – 2012-02-23 18:39:22

+0

這是解決了,我有一些衝突的JS – 2012-02-23 18:48:01

回答

0

您可以使用.mouseover()& .mouseout()事件來處理它。