Results 1 to 2 of 2

Thread: opacity using prototype

  1. #1
    Join Date
    Jun 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default opacity using prototype

    I need to implement opacity using prototype. The code I written for opacity ( new Effect.Opacity(element.id, ..) is not working with safari and chrome. Any suggestion on how to use opacity using prototype that will work for all the browsers.

    Thanks.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,920
    Thanks
    43
    Thanked 3,187 Times in 3,151 Posts
    Blog Entries
    12

    Default

    What versions of Prototype/Scriptaculous are you using?

    Works fine here in Safari and Chrome:

    http://madrobby.github.com/scriptacu...ffect-opacity/

    Working demo code:

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <title>Opacity Demo - Prototype/Scriptaculous</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js"></script>
    </head>
    <body>
    <div id="opacity_demo" style="width:100px; height:100px; background:#ccc;"></div>
    <ul>
      <li><a href="#" onclick="new Effect.Opacity('opacity_demo', { from: 1, to: 0 }); return false;">Hide this box</a></li>
      <li><a href="#" onclick="new Effect.Opacity('opacity_demo', { from: 0, to: 1 }); return false;">Show this box</a></li>
    </ul>
    </body>
    </html>
    Last edited by jscheuer1; 06-04-2012 at 09:53 PM. Reason: add link and demo code
    - John
    ________________________

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

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
  •