jQuery:如果我的 css 可见性:隐藏,我如何显示我的元素?

发布于 2024-10-07 02:44:22 字数 353 浏览 7 评论 0原文

在我的CSS中我设置了一些元素visibiliy:hidden,我怎样才能显示它们?

我以前用不透明度做过,但我在 IE 中有一些错误:

var i = 0;
$mySelection.each(function(i) {
    $(this).delay((i * 100) + ($mySelection.length)).animate(
        { opacity: "1"},
        {queue:true, duration:1000, easing:"quartEaseIn"}
    ); 
})

如果我想用 jQuery 而不是不透明度来控制可见性,我该怎么办? 谢谢

in my css i've set some elements visibiliy:hidden, how can I show them?

I've done it before with opacity, but i've some bug in IE:

var i = 0;
$mySelection.each(function(i) {
    $(this).delay((i * 100) + ($mySelection.length)).animate(
        { opacity: "1"},
        {queue:true, duration:1000, easing:"quartEaseIn"}
    ); 
})

How can i do if I want controll visibility with jQuery instead of opacity?
thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

请恋爱 2024-10-14 02:44:22
$(":hidden").css("visibility", "visible");
$(":hidden").css("visibility", "visible");
殊姿 2024-10-14 02:44:22

不要使用 visibility:hidden,而是使用 display:none,然后如果您想淡入隐藏元素,请使用 淡入。例如:

$("div:hidden").fadeIn("slow");

编辑:假设您想使用可见性,请尝试以下操作:

var i = 0;
$mySelection.each(function(i) {
    $(this).delay((i * 100) + ($mySelection.length)).css(
        { 'opacity': '0', 'visibility': 'visible'}).animate(
            { opacity: "1"},
            {queue:true, duration:1000, easing:"quartEaseIn"});
});

Rather than using visibility: hidden, use display:none, then if you want to fade in your hidden element use fadeIn. For example:

$("div:hidden").fadeIn("slow");

Edit: Given that you want to use visibility, try this:

var i = 0;
$mySelection.each(function(i) {
    $(this).delay((i * 100) + ($mySelection.length)).css(
        { 'opacity': '0', 'visibility': 'visible'}).animate(
            { opacity: "1"},
            {queue:true, duration:1000, easing:"quartEaseIn"});
});
浮光之海 2024-10-14 02:44:22

我使用此代码通过 Jquery 更改 CSS 可见性属性。悬停时的 element1 将改变 element2 的可见性。

对同一元素执行了两个不同的脚本以产生 mouseover-mouseleave 效果。

 <script>$(document).ready(function(){
 $(".element1").mouseover(function(){
     $(".element2").css("visibility","visible");
 });

});

         <script>$(document).ready(function(){
 $(".element1").mouseleave (function(){
     $(".element2").css("visibility","hidden");
 });

});

注意:Element2(CSS 受到影响)最初是隐藏的。所以当鼠标悬停在 Element1 上时,Element2 就会出现。当鼠标离开element1时,Element2再次隐藏。希望它有帮助

-此代码在堆栈溢出中重新研究和混合用户的一些其他代码的经验

I used this code to change the CSS visibility attribute with Jquery. Where the element1 on hover will change visibility of element2.

Did two different script for same element to give a mouseover-mouseleave effect.

 <script>$(document).ready(function(){
 $(".element1").mouseover(function(){
     $(".element2").css("visibility","visible");
 });

});

         <script>$(document).ready(function(){
 $(".element1").mouseleave (function(){
     $(".element2").css("visibility","hidden");
 });

});

Note.- That Element2 the one thats CSS is being affected, originally is hidden. so when mouse is over Element1, Element2 shows up. When mouse leaves element1, Element2 Hides again. Hope it helps

-Expiriance of this code reaserching and mixing some other codes from users in stack overflow

客…行舟 2024-10-14 02:44:22
$(':hidden').show();

我希望这有帮助,我希望我理解你的问题:) http://api.jquery.com/show/< /a>

$(':hidden').show();

I hope this helps and I hope I understood your question :) http://api.jquery.com/show/

咆哮 2024-10-14 02:44:22

尝试

$mySelection.show();

Try

$mySelection.show();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文