English 中文(简体)
Fade-in and Fadeout animation methods with organic java 成文法
原标题:Fade-in and Fade-out animation methods with pure javaScript code

概述:问题摘要是,我想找到与我们正在执行的简便守则相对应的复杂守则。 我提到的法典是关于“Fade-in”和“Fade-out” an法。 我想使用纯java文本而不是jQuery。

这是在“贱民”中使用的法典,我希望是相等的纯 j。 文本。

下面的法典对你来说是明确的,但我要以我为借口指出不止一点,

* 第一点:只有一顿子来履行这一职能(即两种条件下的“进出”法)。

* 第二点:四级是集装箱的标签,其等级为“msg”,但内部没有文字(即,在html),案文一开始即行(即,在 Java文)。

“entergraph

<body>

     <form autocomplete="off">
        <input type="text" name="username" id="username" placeholder="Enter Username">
        <button type="button" id="btn">OK</button>
     </form>
     <div class="msg"></div>

     <script>
           $(document).ready(function (){

$( #btn ).click(function (){
     let usName = $( #username ).val();
     
     if(usName !=   ){
        $( .msg ).html( Welcome   + usName);
        $( .msg ).fadeIn(1500);
     }else{
        $( .msg ).html( Username is required );
        $( .msg ).fadeIn(1000).delay(1000).fadeOut(1000);
     }
                            });
                                        }); 
     </script>
     
</body>

我试图做的是非常简单的法典,它没有任何动态的估算方法,但法典也得到了很好的执行。

<body>
   
    <form autocomplete="off">
        <input type="text" name="username" id="username" placeholder="Enter Username">
        <button type="button" id="btn" onclick="show()">OK</button>
     </form>
     
     <div class="msg"></div>
    

     <script>
function show()

{    let usName = document.getElementById("username").value;

if (usName != "")
    { 
  document.getElementsByClassName("msg")[0].innerHTML = "Welcome" +" "+ usName;
    }
else
{
  document.getElementsByClassName("msg")[0].innerHTML = "Username is required";
}
  }
     </script>

</body>

https://i.stack.imgur.com/QnivF.jpg” rel=“nofollow noreferer”>。

问题回答

摘自j Query网站:

.fadeIn()方法显示了对应要素的不透明性。

因此,撰写一门不透明、过渡的剪辑。

.fade-out {
  opacity: 0;
  transition: opacity 1500ms;
}

现在使用简便的Java语将这一类别应用到你想要从你想要的那部分人中删除的那类内容。

document.getElementById( myId ).classList.add( fade-out );
document.getElementById( myId ).classList.remove( fade-out );

如果你想要不影响你的布局。 可在填满后立即将其编成<代码>。

你可以尝试:

.fade-in-out{
   opacity:0;
   transition: 1s;
}

您可以灵活地增加或删除班名

document.querySelector( .my-element ).classList.toggle( fade-in-out );




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签