jQuery切换显示/隐藏 [英] jQuery toggle show/hide

查看:88
本文介绍了jQuery切换显示/隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我想在有人按下图片时显示/隐藏在我的页面上切换div。 (这个图像将是某种按钮)



但不知怎的,我不能让它工作......



 <   li     class   =  menu >  <   img     src   =  images / menu.png >  <   / li  >  
< < span class =code-leadattribute> div id = menubalk > < ; / div >





 menubalk  {
position 绝对;
width 200px;
height 400px;
background black;
z -index 3;
margin-top 73px;
}





 $( 。menu)。click(  function (){
$( # menubalk)。togoggle( slow function (){
});
});





我上传了我的文件,如果你点击以下链接http://eduweb.hhs.nl/~11028416/html/ [ ^ ]



您将看到一个黑色矩形。这是#menubalk。矩形上方的3条白色条纹是.menu



我也做了一个jsfiddle。同上面只有3条白色条纹不存在,但我想这不是问题吗?



http://jsfiddle.net/Lg3wvqqu/ [ ^ ]



也许这澄清了一点



有谁知道为什么这不起作用?那真是太棒了!



提前致谢,



工作

解决方案

。menu)。click( function (){


#menubalk)。togoggle( slow function (){
});
});





我上传了我的文件,如果您点击以下链接 http://eduweb.hhs.nl/~11028416/html/ [ ^ ]



你会看到一个黑色矩形。这是#menubalk。矩形上方的3条白色条纹是.menu



我也做了一个jsfiddle。同上面只有3条白色条纹不存在,但我想这不是问题吗?



http://jsfiddle.net/Lg3wvqqu/ [ ^ ]



也许这澄清了一点



有谁知道为什么这不起作用?那真的很棒!



提前致谢,



工作

你的内部函数( .toggle 的第二个参数)是空的,所以它不可能做任何事情:-)

< pre lang =Javascript>


Hello, I want to show/hide toggle a div on my page when someone presses on a image. (this image will be some kind of button)

But somehow I cant get it to work...

<li class="menu"><img src="images/menu.png"></li>
<div id="menubalk"></div>



#menubalk {
position: absolute;
width: 200px;
height: 400px;
background: black;
z-index: 3;
margin-top: 73px;
}



$( ".menu" ).click(function() {
  $( "#menubalk" ).toggle( "slow", function() {
  });
});



I've uploaded my files, if you click the following link http://eduweb.hhs.nl/~11028416/html/[^]

you will see a black rectangle. This is the #menubalk. The 3 white stripes above the rectangle is .menu

I've also made a jsfiddle. Same as above only the 3 white stripes are not there but I guess thats not a problem right?

http://jsfiddle.net/Lg3wvqqu/[^]

Maybe this clarifies a bit

Does anybody knows why this is not working? That would be really great!

Thanks in advance,

Job

解决方案

( ".menu" ).click(function() {


( "#menubalk" ).toggle( "slow", function() { }); });



I've uploaded my files, if you click the following link http://eduweb.hhs.nl/~11028416/html/[^]

you will see a black rectangle. This is the #menubalk. The 3 white stripes above the rectangle is .menu

I've also made a jsfiddle. Same as above only the 3 white stripes are not there but I guess thats not a problem right?

http://jsfiddle.net/Lg3wvqqu/[^]

Maybe this clarifies a bit

Does anybody knows why this is not working? That would be really great!

Thanks in advance,

Job


You inner function (the second parameter of .toggle) body is empty, so it cannot possibly do anything :-)


这篇关于jQuery切换显示/隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆