Loading ...
Sorry, an error occurred while loading the content.

356Re: [ydn-javascript] Slide Element Toggle

Expand Messages
  • Matt Sweeney
    Feb 28, 2006
    • 0 Attachment
      Hi Trevor,

      Try adding the "from" property to your height attributes:

      var UpAttributes = {
      height: {from: 100, to: 0, unit: 'px'},
      fontSize: {from: 100, to: 0, unit: '%'},
      opacity: { to: 0 }
      }

      var DownAttributes = {
      height: {from 0, to: 100, unit: 'px'},
      fontSize: {from: 0, to: 100, unit: '%'},
      opacity: { to: 1 }
      }

      Matt


      tbtingey wrote:

      >Awesome library. I look forward to using to create my own components.
      >Speaking of which, I am trying to create an effect similar to the
      >scriptaculous slide toggle:
      >http://wiki.script.aculo.us/scriptaculous/show/Effect.toggle
      >(see the slide effect)
      >
      >Anyway, I'm getting an error in IE (and not in firefox) when I try to
      >access the height on the element that I'm "sliding" up/away. Here's my
      >js file:
      >
      >var UpAttributes = {
      > height: {to: 0, unit: 'px'},
      > fontSize: {from: 100, to: 0, unit: '%'},
      > opacity: { to: 0 }
      >}
      >
      >var DownAttributes = {
      > height: {to: 100, unit: 'px'},
      > fontSize: {from: 0, to: 100, unit: '%'},
      > opacity: { to: 1 }
      >}
      >
      >function SlideUp(owner)
      >{
      > var AppointmentsDivSlideUp = new YAHOO.util.Anim(owner,
      >UpAttributes, .5, YAHOO.util.Easing.easeNone);
      > AppointmentsDivSlideUp.animate();
      >}
      >
      >function SlideDown(owner)
      >{
      > var AppointmentsDivSlideDown = new YAHOO.util.Anim(owner,
      >DownAttributes, .5, YAHOO.util.Easing.easeNone);
      > AppointmentsDivSlideDown.animate();
      >}
      >
      >function ToggleCategory(ownerId)
      >{
      > var owner = YAHOO.util.Dom.get(ownerId);
      > var height = YAHOO.util.Dom.getStyle(owner, 'height');
      > var isUp = height=='0px';
      >
      > if(isUp)
      > {
      > SlideDown(owner);
      > }
      > else
      > {
      > SlideUp(owner);
      > }
      >}
      >
      >I have a div with an onclick event handler that calls ToggleCategory
      >with the id of the element(another div) that I'm trying to "slide".
      >The error that I get is "Invalid argument" on line 10 of dom.js
      >(starting with "break;default:") with the following causing the error:
      >"el.style[property]=val"
      >where property == 'height', val == 'NaN%', el = div
      >
      >If I drill into it, el.height is 'auto'
      >
      >Any ideas?
      >
      >-Trevor
      >
      >
      >
      >
      >
      >
      >Yahoo! Groups Links
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
    • Show all 4 messages in this topic