English 中文(简体)
可见度:可见度/隐蔽度
原标题:visibility:visible/hidden div

在被点击后,然后用近的纽子隐藏起来时,展示干 the的最佳方式是什么?

我的《格奇法》如下:

$(".imageIcon").click(function(){
$( .imageShowWrapper ).css("visibility",  visible );
});
 $(".imageShowWrapper").click(function(){
$( .imageShowWrapper ).css("visibility",  hidden );
});

除问题Im外,它自动关闭,没有点击。 它装上所有ok,显示大约1/2个sec,然后关闭。 任何想法?

最佳回答

您可使用<代码>show和hide方法:

$(".imageIcon").click(function() {
    $( .imageShowWrapper ).show();
});

$(".imageShowWrapper").click(function() {
    $(this).hide();
});
问题回答

另一种选择:

$(".imageIcon, .imageShowWrapper").click(function() {  
    $(".imageShowWrapper").toggle($(this).hasClass( imageIcon ));     
});

也可使用<条码>fadeToggle<>/code>和<条码>。

$(".imageIcon, .imageShowWrapper").click(function(){
    $( .imageShowWrapper ).toggle();
});

说不见你们的html,.笑话。 但是,与你显示/照亮红线的那部分情况一样,四舍五入正受到页重载的影响? 您可能会将显示/hide div的代码列入$(document).ready(Function(){......})栏。 另外,要指出的另一个相关点是,每当Thton、 anchor等html分子被点击时,就把点击视为违约类型 = 提交,该网页也将在这种情况下重载。 为此,可使用<代码>event.preventDefault()。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签