Robert Johnstone
Robert Johnstone

Reputation: 5371

Animating the width of a DIV or SPAN in Dojo

I have tried doing this but with out success (all this stuff is so easy in jQuery. arrrrr!!!)

I have tried the following (and various permutations) but without success:

<body>
<span id="responseMsg" style="width:250px">Hi There</span>
</body>

JS:

dojo.animateProperty({
    node: dojo.byId("responseMsg"), duration: 1000,
    properties: {
        backgroundColor: { start: "white", end: "#66CC00" }
    }
}).play();
dojo.animateProperty({
    node: dojo.byId("responseMsg"), duration: 1000,
    properties: {
        width: 0
    }
}).play();

I have fiddled it up here so you can see what I mean. (I'm guessing dojo animates css properties not tag variables)

Upvotes: 0

Views: 172

Answers (1)

Raoul
Raoul

Reputation: 366

Give your span-element a block-level-layout and it should work.

<span id="responseMsg" style="width:250px;display:block;">Hi There</span>

By the way, inline-css is very hard to maintain.

Your updated fiddle: http://jsfiddle.net/VfEye/1/

Upvotes: 1

Related Questions