开发者

Is it possible to use animate the top positioning of an element using percentages and a variable?

开发者 https://www.devze.com 2023-03-25 00:20 出处:网络
\'thisAnchorMargin is an float. why doesn\'t this work? if i just put a numerical value in there and don\'t concatenate the % (e.g. top: 50%) it works. is this not a valid unit type to animate in jque

'thisAnchorMargin is an float. why doesn't this work? if i just put a numerical value in there and don't concatenate the % (e.g. top: 50%) it works. is this not a valid unit type to animate in jquery?

$('.mar开发者_C百科kerContainer').stop().animate({
    top: thisAnchorMargin + '%'
    }, {
    duration:scrollSpeedGlobal,
    queue:false
    });


I tried it with several different floats (concatenating the '%') and it works just fine, at least in Chrome/Mac. http://jsfiddle.net/9d6ck/

0

精彩评论

暂无评论...
验证码 换一张
取 消