如何使用jQuery特效函数? jjQuery

时间:2016-02-21 22:46:24

标签: jquery html

jQuery documentation中,<hta:application icon="#" border="thin" borderStyle="static" caption="yes" innerBorder="no" maximizeButton="no" minimizeButton="yes" navigable="no" scroll="no" scrollFlat="yes" singleInstance="yes" showInTaskbar="yes" windowState="normal" contextMenu="no" version="1.0" > <!DOCTYPE html> <HTML><HEAD><TITLE>Note Tool</TITLE> <style type='text/css'> </style> </head> <SCRIPT LANGUAGE="VBScript"> Function Writer_OnClick() UserID = (Document.getElementByID("OB1").Value) ContactName = (Document.getElementByID("OB2").Value) ExternalNotes = (Document.getElementByID("OB3").Value) InternalNotes = (Document.getElementByID("OB4").Value) CSKBRef = (Document.getElementByID("OB5").Value) Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile("html01.txt",1) HTML01 = objFileToRead.ReadAll() objFileToRead.Close Set objFileToRead = Nothing Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile("html02.txt",1) HTML02 = objFileToRead.ReadAll() objFileToRead.Close Set objFileToRead = Nothing Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile("html03.txt",1) HTML03 = objFileToRead.ReadAll() objFileToRead.Close Set objFileToRead = Nothing Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile("html04.txt",1) HTML04 = objFileToRead.ReadAll() objFileToRead.Close Set objFileToRead = Nothing Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile("html05.txt",1) HTML05 = objFileToRead.ReadAll() objFileToRead.Close Set objFileToRead = Nothing Set objFileToWrite = CreateObject("Scripting.FileSystemObject").OpenTextFile("poop.html",2,true) objFileToWrite.WriteLine(HTML01) objFileToWrite.WriteLine(UserID) objFileToWrite.WriteLine "</li><li>Contacts: " objFileToWrite.WriteLine(ContactName) objFileToWrite.WriteLine(HTML02) objFileToWrite.WriteLine(ExternalNotes) objFileToWrite.WriteLine(HTML03) objFileToWrite.WriteLine(InternalNotes) objFileToWrite.WriteLine(HTML04) objFileToWrite.WriteLine(CSKBRef) objFileToWrite.WriteLine(HTML05) objFileToWrite.Close Set objFileToWrite = Nothing End Function </SCRIPT> <script language="VBScript"> Sub ClearText User.Value = "" Contact.Value = "" ExternalNotes.Value = "" InternalNotes.Value = "" CSKB.Value = "" End Sub </script> <SCRIPT LANGUAGE="JavaScript"> function RestoreWindowSize() { window.resizeTo(750, 420); } </script> <SCRIPT LANGUAGE="JavaScript"> var desc = new Array(); desc['OB1'] = 'User ID'; desc['OB2'] = 'Contact Name'; desc['OB3'] = 'External Notes'; desc['OB4'] = 'Internal Notes'; desc['OB5'] = 'CSKB Topic'; function CopyFields(){ var copytext = ''; for(var i = 0; i < arguments.length; i++){ copytext += desc[arguments[i]] + ': ' + document.getElementById(arguments[i]).value + '\r\n'; } var tempstore = document.getElementById(arguments[0]).value; document.getElementById(arguments[0]).value = copytext; document.getElementById(arguments[0]).focus(); document.getElementById(arguments[0]).select(); document.execCommand('Copy'); document.getElementById(arguments[0]).value = tempstore; } </script> <body onload="RestoreWindowSize()"> User ID: <input type="text" name="User" id="OB1"><br> Contact Name: <input type="text" name="Contact" id="OB2"><br> External Notes: <textarea rows="5" cols="68" type="text" name="ExternalNotes" id="OB3"></textarea><br> Internal Notes: <textarea rows="5" cols="68" type="text" name="InternalNotes" id="OB4"></textarea><br> KB Reference(s): <input type="text" name="CSKB" id="OB5"><br> <br><br> <input type="button" onClick="ClearText" value="Clear Me"> <input type="button" name="Copier" value="Copy Me" onClick="CopyFields 'OB1', 'OB2', 'OB3', 'OB4', 'OB5'"> <input type="button" name="Writer" value="Write Me"> </body> </html> fadeIn()等效果会对最初隐藏的元素产生影响。但是如何让元素最初被隐藏?当我查看我的HTML时,我想要淡入的对象已经可见。

2 个答案:

答案 0 :(得分:1)

例如,fadeIn() jQuery方法适用于css opacity属性。在css或html样式标记中设置元素样式opacity = 0,它应该有效 同样,slideIn()方法适用于可见性,因此最初将其css属性visibility设置为hiddencollapse

答案 1 :(得分:0)

两种可能的方法:

  1. onDocumentReady()函数中,在调用效果之前,请在这些元素上调用.hide()

  2. 在这些元素的样式中设置visibility:hidden