Wednesday, July 3, 2024
HomeLanguagesJavascriptscript.aculo.us Pulsate Effect

script.aculo.us Pulsate Effect

In this article we will demonstrate the effect of Pulsate by using JavaScript library called script.aculo.us having smooth transition from one to another. We can adjust the duration of the effect as well.

Syntax:

Effect.Pulsate('id_of_element');
Effect.Pulsate('id_of_element', { pulses: 5, duration: 1.5 });

Note: To use this library we are suppose to download or install the library and then use it in our programs. And to do so you can follow the this link http://script.aculo.us/downloads.

Approach:

To demonstrate the use of this function we have written a small piece of code. In which we have written a small JavaScript function named ShowEffect() method which uses Pulsate() method of this library. By clicking on Click Image to Pulsate, you will see the effect clearly.

Example: To see the effect first install the library and then open the following program in local environment.

HTML




    <html>
   <head>    
  
      <script type = "text/javascript" 
       src="scriptaculous-js-1.9.0/lib/prototype.js">
      </script>
      <script type = "text/javascript" 
       src="scriptaculous-js-1.9.0/src/scriptaculous.js?load = effects">
      </script>
          
      <script type = "text/javascript">
        
           function ShowEffect(element){
            new Effect.Pulsate(element, { duration: 3.0 });
         }          
      </script>
   </head>
     
   <body>
        <h2>Pulsate Effect for Image</h2>                 
    <div id="hideshow" onclick = "ShowEffect(this);">
             <img src = "GEEKSIMAGES/neveropen1.PNG" alt = "" /><br/>
         Click Image to Pulsate
    </div>
   </body>
</html>
     


Output:

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments