Results 1 to 3 of 3

Thread: js opactiy constant blink

  1. #1
    Join Date
    Jan 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default js opactiy constant blink

    Hi all,

    wondering if its possible to create a constant blink without hover:

    Code:
    function fade_hover() {
    	jQuery('.fade_hover').hover(
    		function() {
    				jQuery(this).stop().animate({opacity:0.4},400);
    			},
    			function() {
    				jQuery(this).stop().animate({opacity:1},400);
    		});
    
    }
    Any help is appreciated

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <title>jQuey Blinking Opacity Demo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
    <script type="text/javascript">
    jQuery(function($){
    	var targetOpacities = [0.4, 1], opacityIndex = 0;
    	function fadeThem(){	
    		$('.faders').animate({opacity: targetOpacities[opacityIndex]}, 400, fadeThem);
    		opacityIndex = opacityIndex? 0 : 1;
    	}
    	fadeThem();
    });
    </script>
    </head>
    <body>
    <p><img class="faders" src="photo1.jpg" alt="original image" title=""></p>
    <p><img class="faders" src="photo2.jpg" alt="original image" title=""></p>
    </body>
    </html>
    Demo:

    http://home.comcast.net/~jscheuer1/s...blink_jq_h.htm
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jan 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you my friend.

    Happy Holidays!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •