Skip to main content

Bug Tracker

Side navigation

#6191 closed bug (invalid)

Opened March 01, 2010 02:25PM UTC

Closed November 19, 2010 04:23AM UTC

Assigining CSS property in animate() via external variable fails

Reported by: riddle Owned by:
Priority: undecided Milestone:
Component: effects Version: 1.4.2
Keywords: animate property Cc:
Blocked by: Blocking:
Description

var part = 'left'; for testing purposes only

var margin_variable = 'margin-' + part;

this works:

$element.stop().animate({

'margin-left': '-100px',

'opacity': '1.0'

}, 100);

// this won't work:

$element.stop().animate({

margin_variable: '-100px',

'opacity': '1.0'

}, 100);

Attachments (0)
Change History (2)

Changed November 12, 2010 02:40AM UTC by snover comment:1

milestone: 1.4.3

Resetting milestone to future.

Changed November 19, 2010 04:23AM UTC by dmethvin comment:2

priority: → undecided
resolution: → invalid
status: newclosed
var args = { opacity: '1.0' };
args['margin-'+part] = '-100px';
$element.stop().animate(args, 100);

Ask for help on the forum if you need to learn more.