In this article I will show you how to use jQuery fadetoggle. In this jQuery toggle demo, when the user clicks the help icon an information message will be displayed by jQuery fade animation effects. Next, the user again clicks the icon it will disappears with jQuery toggle animation effects. You can also control fade time by setting it as (2000) milliseconds.
Syntax:
jQuery(elements).fadeToggle([duration], [callback]);
fadetoggle jQuery example:
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#help").click(function () {
$("#helpText").fadeToggle(2000);
});
});
</script>
<style type="text/css">
form {
width:280px;
margin: 100px auto;
position: relative;
}
input {
margin-left: 5px;
}
#help {
display: block;
width:36px;
height: 46px;
padding: 6px -22px -1px 29px;
margin-top: -27px;
margin-right: -37px;
left:27px;
float:right;
cursor: pointer;
background: url(../images/Help.png) no-repeat;
}
#helpText {
display: none;
width:183px;
height: 32px;
padding: 5px 4px 5px 5px;
border: 2px solid rgba(116, 111, 117, 0.08);
position: absolute;
left:115px;
top:-58px;
font:normal 12px "Nimbus Sans L", "Helvetica Neue", "Franklin GothicMedium",Sans-serif;
}
</style>
<div style="border: 1px solid red; height: 255px; width: 404px; padding: 33px 27px 0px 3px;">
<form>
<label for="name">
Enter your name:
<input id="name" name="name" type="text" placeholder="enter name" />
<spanid="help"></span><span id="helpText">Your name. You know, thething that people all you</span>
</label>
</form>
</div>
Output:
Post your comments / questions
Recent Article
- How to fix HAXM is not installed |in Android Studio
- How to fix CMOS Checksum Error in Computer or Laptop | SOLVED
- Reactivating windows after a Hardware change on PC or Laptop
- FIXED: Windows reported that the hardware of your device has changed. Error code :0xc004F211
- "redirect" is not defined pylance("reportUndefinedVariable)
- This action cannot be completed because the file is open in SQL Server(SQLEXPRESS) - FIXED
- Unicode error 'unicodeescape' codec can't decode bytes in position 2-3: truncated UXXXXXXXX escape
- Could not find the 'angular-devkit/build-angular:dev-server' builder's node package | Angular Error
Related Article