Dynamic Profile Codes
Would you like to react to this message? Create an account in a few clicks or log in to continue.

gradual element fader

+4
MoiMoi<3
MhingMhengXD
Patrick
danielvicedo
8 posters

Go down

gradual element fader Empty gradual element fader

Post by danielvicedo Sat Oct 17, 2009 1:19 pm

sorry! no preview but help me explain it to those who knew how it works. thanks.

btw. here's the
Code:
//Gradual Elements Fader- By Dynamic Drive at http://www.dynamicdrive.com
//Last updated: Nov 8th, 07'

var gradualFader={}

gradualFader.baseopacity=0.4 //set base opacity when mouse isn't over element (decimal below 1)
gradualFader.increment=0.2 //amount of opacity to increase after each iteration (suggestion: 0.1 or 0.2)

document.write('<style type="text/css">\n') //write out CSS to enable opacity on "gradualfader" class
document.write('.gradualfader{filter:progid:DXImageTransform.Microsoft.alpha(opacity='+gradualFader.baseopacity*100+'); -moz-opacity:'+gradualFader.baseopacity+'; opacity:'+gradualFader.baseopacity+';}\n')
document.write('</style>')

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
}

gradualFader.fadeupdown=function(obj, direction){
   var targetobject=obj
   var fadeamount=(direction=="fadeup")? this.increment : -this.increment
   if (targetobject && (direction=="fadeup" && targetobject.currentopacity<1 || direction=="fadedown" && targetobject.currentopacity>this.baseopacity)){
      this.setopacity(obj, targetobject.currentopacity+fadeamount)
      window["opacityfader"+obj._fadeorder]=setTimeout(function(){gradualFader.fadeupdown(obj, direction)}, 50)
   }
}

gradualFader.clearTimer=function(obj){
if (typeof window["opacityfader"+obj._fadeorder]!="undefined")
   clearTimeout(window["opacityfader"+obj._fadeorder])
}

gradualFader.isContained=function(m, e){
   var e=window.event || e
   var c=e.relatedTarget || ((e.type=="mouseover")? e.fromElement : e.toElement)
   while (c && c!=m)try {c=c.parentNode} catch(e){c=m}
   if (c==m)
      return true
   else
      return false
}

gradualFader.fadeinterface=function(obj, e, direction){
   if (!this.isContained(obj, e)){
      gradualFader.clearTimer(obj)
      gradualFader.fadeupdown(obj, direction)
   }
}

gradualFader.collectElementbyClass=function(classname){ //Returns an array containing DIVs with specified classname
   var classnameRE=new RegExp("(^|\\s+)"+classname+"($|\\s+)", "i") //regular expression to screen for classname within element
   var pieces=[]
   var alltags=document.all? document.all : document.getElementsByTagName("*")
   for (var i=0; i<alltags.length; i++){
      if (typeof alltags[i].className=="string" && alltags[i].className.search(classnameRE)!=-1)
         pieces[pieces.length]=alltags[i]
   }
   return pieces
}

gradualFader.init=function(){
   var targetobjects=this.collectElementbyClass("gradualfader")
   for (var i=0; i<targetobjects.length; i++){
      targetobjects[i]._fadeorder=i
      this.setopacity(targetobjects[i], this.baseopacity)
      targetobjects[i].onmouseover=function(e){gradualFader.fadeinterface(this, e, "fadeup")}
      targetobjects[i].onmouseout=function(e){gradualFader.fadeinterface(this, e, "fadedown")}
   }
}

compile it as a JS form. Then, here you go. XD
danielvicedo
danielvicedo
DPC Freak

Male
Posts : 1078
Age : 29
Joined date : 2009-10-16
Location : under my bebe's bed. :)
Cash : 28323

http://danielvicedo.tk

Back to top Go down

gradual element fader Empty Re: gradual element fader

Post by Patrick Sat Oct 17, 2009 6:53 pm

nice. :]

thanks for this. ^_^
Patrick
Patrick
DPC Elite

Male
Posts : 4574
Age : 29
Joined date : 2009-10-13
Location : Molino, Bacoor, Cavite, Philippines
Cash : 2147510242

http://akosipat.co.cc

Back to top Go down

gradual element fader Empty Re: gradual element fader

Post by danielvicedo Sat Oct 17, 2009 10:35 pm

your welcome Patrick.. gradual element fader 286191
danielvicedo
danielvicedo
DPC Freak

Male
Posts : 1078
Age : 29
Joined date : 2009-10-16
Location : under my bebe's bed. :)
Cash : 28323

http://danielvicedo.tk

Back to top Go down

gradual element fader Empty Re: gradual element fader

Post by MhingMhengXD Tue Oct 20, 2009 2:49 pm

cant relate:(
:(
MhingMhengXD
MhingMhengXD
DPC Elite

Female
Posts : 4895
Age : 29
Joined date : 2009-10-17
Location : sa tabi mo:3
Cash : 28457

http://friendster.com/purteenxd

Back to top Go down

gradual element fader Empty Re: gradual element fader

Post by MoiMoi<3 Tue Oct 27, 2009 8:46 pm

. wers yur credits then? tsk!
MoiMoi<3
MoiMoi<3
DPC Addict

Female
Posts : 218
Age : 31
Joined date : 2009-10-26
Location : yur BF's room
Cash : 27826

Back to top Go down

gradual element fader Empty Re: gradual element fader

Post by danielvicedo Tue Oct 27, 2009 8:48 pm

I don't need to add credit 'coz I'm a former Dynamic Drive member. gradual element fader 286191
Credits to me. gradual element fader 286191
danielvicedo
danielvicedo
DPC Freak

Male
Posts : 1078
Age : 29
Joined date : 2009-10-16
Location : under my bebe's bed. :)
Cash : 28323

http://danielvicedo.tk

Back to top Go down

gradual element fader Empty Re: gradual element fader

Post by MoiMoi<3 Tue Oct 27, 2009 8:54 pm

^ . that rank doesn't satisfied THAT CODE. omg. lmao
MoiMoi<3
MoiMoi<3
DPC Addict

Female
Posts : 218
Age : 31
Joined date : 2009-10-26
Location : yur BF's room
Cash : 27826

Back to top Go down

gradual element fader Empty Re: gradual element fader

Post by danielvicedo Tue Oct 27, 2009 8:56 pm

maybe . hmm ? Be on the topic. gradual element fader 286191
danielvicedo
danielvicedo
DPC Freak

Male
Posts : 1078
Age : 29
Joined date : 2009-10-16
Location : under my bebe's bed. :)
Cash : 28323

http://danielvicedo.tk

Back to top Go down

gradual element fader Empty Re: gradual element fader

Post by MoiMoi<3 Tue Oct 27, 2009 8:59 pm

yes i am my dear. ::
dats why i am posting hirr .
MoiMoi<3
MoiMoi<3
DPC Addict

Female
Posts : 218
Age : 31
Joined date : 2009-10-26
Location : yur BF's room
Cash : 27826

Back to top Go down

gradual element fader Empty Re: gradual element fader

Post by HAZEL Fri Oct 30, 2009 3:55 pm

nice.
thankz for sharing
HAZEL
HAZEL
DPC Elite

Female
Posts : 3699
Age : 28
Joined date : 2009-10-26
Location : DAVAO
Cash : 34510

http://neesayzel.multiply.com/

Back to top Go down

gradual element fader Empty Re: gradual element fader

Post by lovebang01 Sat Oct 31, 2009 8:06 pm

aw!
lovebang01
lovebang01
DPC Addict

Male
Posts : 166
Age : 32
Joined date : 2009-10-26
Location : Bacolod City
Cash : 27748

http://friendster.com/admerbakud

Back to top Go down

gradual element fader Empty Re: gradual element fader

Post by XED Sat Oct 31, 2009 8:14 pm

tnx sir.
XED
XED
Global Moderator
 Global Moderator

Male
Posts : 6137
Age : 114
Joined date : 2009-10-22
Location : sa bag mo :]]
Cash : 32117

Back to top Go down

gradual element fader Empty Re: gradual element fader

Post by kimpot909 Sat Oct 31, 2009 8:18 pm

thnx 4 sharin
kimpot909
kimpot909
DPC Addict

Female
Posts : 251
Age : 29
Joined date : 2009-10-10
Location : Novaliches
Cash : 27911

http://profiles.friendster.com/khimpawpotoi

Back to top Go down

gradual element fader Empty Re: gradual element fader

Post by danielvicedo Tue Dec 08, 2009 12:09 am

Thank you guys.
danielvicedo
danielvicedo
DPC Freak

Male
Posts : 1078
Age : 29
Joined date : 2009-10-16
Location : under my bebe's bed. :)
Cash : 28323

http://danielvicedo.tk

Back to top Go down

gradual element fader Empty Re: gradual element fader

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum