Your styles are out of order, put the toggle one below. The .content definition over-rides the width.

If you aren't trying to animate then just:

$('inhalt').addClass('content_toggle');

and

$('inhalt').removeClass('content_toggl');

Ryan Florence
http://blog.flobro.com
Recent Entry: Mootools Mixins

On Oct 21, 2009, at 1:10 PM, hamburger wrote:


thx for your answer
i tried to morph
thame thing: the width will be ignored.

On 21 Okt., 20:49, Stewart Mckinney <[email protected]> wrote:
You can explicitly define both classes like so:
.content_toggle{
 width: 920px;
background-color: red; //use hex here, dont know red's hex off the top of
my head

}

.content{
width: 580px;
background-color: #ffffff;

}

...and then you can morph between them, and change the class after the
morph.

$('inhalt').morph('.content_toggle').set('class','content_toggle');

You will lose other classes on the element this way, however.

You could also set a tween that would toggle the width, and forgo using CSS
altogether,
just using a class name to indicate the toggle's status.

You need to explicitly define all properties in both CSS classes if you use
this method,
however. MooTools will look for properties set in the class - it won't try
to (nor should
it be reasonably expected to) determine inherited style rules when
performing the
morph.

Wait - is that in MT 2.0? ;)

Hope that helps. Can't wait until my project is done so I can finally
contribute a little to More ;)

On Wed, Oct 21, 2009 at 2:21 PM, hamburger <[email protected]> wrote:

hello, i would like to change the width of my dif class

.content_toggle {
               width:920px;
       background-color:red;
               }

to

.content {
               width:580px;
               }

i tried this:

 $('inhalt').toggleClass('content_toggle');
it change the color but not the width.

$('inhalt').setStyle('width', '580px');
works fine but i how to toffle this?

somebody can help?

Reply via email to