English 中文(简体)
Jquery Fade in Text for Certain Time
原标题:Jquery Fade in Text for Certain Time

在我的申请中,我有一段文字,说明有些人在网上或离线时的情况。 我将一些人通过<代码>content = 姓名+从脱掉或反之。 然后,我把这一案文放在我职责结束时的四处:$(#new)text(content);

问题在于失败,所有问题都没有真正发挥作用。 我正试图与它一道工作。 这里我迄今为止所做的事情:

$( #new ).text(content);
$( #new ).fadeIn( slow , function() {
        setTimeout($( #new ).fadeOut( slow , function() {
        $( #new ).css( display ,  none );   
        }));
    });
最佳回答

内部的反馈是不必要的,fadeOut(>在订立合同后自动将显示物排在无。

$( #new ).text(content);
$( #new ).fadeIn( slow , function() {
    setTimeout("$( #new ).fadeOut( slow );", 2000);
});

2000年是你想要拖延的摩擦数量,将其改为符合你的最佳价值。

As @Pst commented, the function-object may be more consistent even though I personally have more issues with function-objects than code strings.

You may also use the function-object:

$( #new ).text(content);
$( #new ).fadeIn( slow , function() {
    setTimeout(function(){ $( #new ).fadeOut( slow ); }, 2000);
});
问题回答

您需要记住,规定<代码>>截止日期/代码>的期限。 应等到采取行动之前。

$("#hello")
  .text(content)
  .fadeIn("slow", function(){
    setTimeout(function(){
      $("#hello").fadeOut();
    }, 2000);
  });

2000年的数字为2秒。 如果你希望它保持可见度更长,就会增加。

职:

您是否在<代码>$(文件)ready(内使用? 否则,它就象:

$(document).ready(function() {
    $( #new )
        .text(content)
        .fadeIn( slow , function() { 
            setTimeout(function() { $( #new ).fadeOut( slow ); }, 2000); 
        });
});

此外,确保用<代码>显示器具启动:无<>/代码>和注一删除了部分不必要代码。

页: 1

为什么不只使用delay?

$("#new").text(content).fadeIn("slow").delay(1000).fadeOut("slow");




相关问题
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!

热门标签