Effects using jquery

By using animate() method we can animate the controls. Here is an example to how to do that. Click the button Click Me! to see how it will work.

This below script gives you a animation effect of a Image Thumbnail using JQuery function animate() This animate() Performs a custom animation of a set of CSS properties . Below I used addClass(),removeClass() to add, remove the specified class(es) to matched elements to maintain the animation state. We will discuss more about add/remove classes using jquery in our next page...


<script language="javascript"> $('#btnclickme').on("click", function () { $('#imganimate').animate({ width: ['toggle', 'swing'], height: ['toggle', 'swing'], opacity: 'toggle' }, 4000) if (!$('#divanimationdone').hasClass('divAnimCompleted')) { $('#divanimationdone').addClass('divAnimCompleted'); $('#divanimationdone').show({ duration: 4000 }); } else { $('#divanimationdone').removeClass('divAnimCompleted'); $('#divanimationdone').hide({ duration: 4000 }); } }); </script>


<style type="text/css"> .divAnim { background-color: black; color: yellow; font-size: medium; } </style>