Results 1 to 8 of 8

Thread: Help adapting script

  1. #1
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help adapting script

    Hello,

    There's this Gradual Element Fader script

    This looks silly, but I've tried here and couldn't do...

    I want to invert the way the script works, like:

    Original script:

    Image with 40% opacity -> mouseover = Image with 100% opacity
    I want to make it from 100% to 40%, Intended script:

    Image with 100% opacity -> mouseover = Image with 40% opacity
    I would gladly accept some suggestions on how to do it *-*

    Thanks in advance

  2. #2
    Join Date
    Dec 2004
    Posts
    177
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default

    In the .js file, at the bottom, try swapping

    targetobjects[i].onmouseover=function(e){gradualFader.fadeinterface(this, e, "fadeup")}
    targetobjects[i].onmouseout=function(e){gradualFader.fadeinterface(this, e, "fadedown")}

    with

    targetobjects[i].onmouseover=function(e){gradualFader.fadeinterface(this, e, "fadedown")}
    targetobjects[i].onmouseout=function(e){gradualFader.fadeinterface(this, e, "fadeup")}

    That won't completely do it, if I'm thinking correctly it will start off with the low opacity but if you mouseover and then mouseout it will do what you are asking.

    I think. Let me know if that is the case.
    Verzeihung!

  3. #3
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default

    try this,
    Last edited by jscheuer1; 08-19-2011 at 12:31 AM. Reason: remove password protected image

  4. #4
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It almost worked.

    Just don't work in Internet Explorer:



    Live demo of the problem:

    http://criatweb.com.br/gigbr/light/

  5. #5
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default

    just checked on IE9 and it worked, which version are you having problems with?

  6. #6
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Crapnet Explorer 8

  7. #7
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default

    hmm, i only have ie9 on my machine, will try to find a way to test on ie8

    you might want to play with these numbers, it says ie6 but might affect other versions of ie
    Code:
    gradualFader.setopacity=function(obj, value){ //Sets the opacity of targetobject based on the passed in value setting (0 to 1 and in between)
    	var targetobject=obj
    	if (targetobject && targetobject.filters && targetobject.filters[0]){ //IE syntax
    		if (typeof targetobject.filters[0].opacity=="number") //IE6
    			targetobject.filters[0].opacity=value*100
    		else //IE 5.5
    			targetobject.style.filter="alpha(opacity="+value*100+")"
    		}
    	else if (targetobject && typeof targetobject.style.MozOpacity!="undefined") //Old Mozilla syntax
    		targetobject.style.MozOpacity=value
    	else if (targetobject && typeof targetobject.style.opacity!="undefined") //Standard opacity syntax
    		targetobject.style.opacity=value
    	targetobject.currentopacity=value
    }

  8. #8
    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

    In IE less than 9 there's a conflict between the alpha opacity filter and .png images saved with alpha channel opacity. Since you know the background color, you could save the image with that instead of making it alpha channel transparent. Then it should work in IE less than 9:

    Attachment 4028
    - 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
  •