Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How run blinking effect of div in Jquery

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 247
    Comment on it

    Hello Reader if you are making the content based website where you want to show div in bounce or blink effect. Here this code is driven by Jquery.

    First create html file with name bounce.html and its code will go like this:-

    <!DOCTYPE html>  
    <html lang="en">  
    <head>  
    
          <link href="http://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">  
          <script src="http://code.jquery.com/jquery-1.10.2.js"></script>  
          <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>     
    </head>  
    <body>  
    <div id="outer">Click here<br/><b>bounce!</b></div>  
    </body>  
    </html> 
    

    Now to make bounce effect to div write the script. This script will go like this:-

      <script>  
                 $(document).ready(function() {  
                    $('#outer').click(function() {  
                       $( "#outer" ).effect( "shake", {  
                          times: 10,  
                          distance: 410  
                       }, 298, function() {  
                       $( this ).css( "background", "#000000" );  
                    });  
                 });  
              });  
        </script>  
    

    And in last add some CSS to it, As below:-

       <!-- CSS -->  
              <style>  
                 #outer {  
                    height: 50px;  
                    width: 100px;  
                    background: #6ff634;  
                 }  
              </style>  
    

    When you load you page, The div in black bolor will appear and on clicking it will create a bounce effect. This effect will work on all plateform like web and mobile. If you want to add more shake/bouce effect you increase the count from 10 to more number.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: