当我点击图标时,我正试图让菜单切换,但它无法正常工作。我怀疑它与选择器有关。这是代码...... HTML
<div class="bild">
<img src="face_kopia.png" class="ikon"/>
</div>
<div class="meny">
<a href="">Home</a>
<a href="">About</a>
<a href="">Gallery</a>
</div>
JQUERY
$(document).ready(function(){
//Hide the tooglebox when page load
$(".meny").hide();
//slide up and down when hover over
$(".ikon").hover(function(){
// slide toggle effect set to slow you can set it to fast too.
$(this).next(".meny").slideToggle("slow");
return true;
});
});
答案 0 :(得分:0)
您的陈述不正确
http://jsfiddle.net/UQTY2/204/
$(document).ready(function () {
//Hide the tooglebox when page load
$(".meny").hide();
//slide up and down when hover over
$(".ikon").hover(function () {
// slide toggle effect set to slow you can set it to fast too.
$(".meny").slideToggle("slow");
return true;
},function(){
$(".meny").slideToggle("slow");
});
});
答案 1 :(得分:0)
当你改变
$(this).next(".meny").slideToggle("slow");
到
$(".meny").slideToggle("slow");
它有效
答案 2 :(得分:0)
$(document).ready(function(){
//Hide the tooglebox when page load
$(".meny").hide();
//slide up and down when hover over
$(".ikon").hover(function(){
// slide toggle effect set to slow you can set
$('.meny').slideToggle("slow");
});
});
这是工作示例
http://jsfiddle.net/5x7xv/9/