javascript - Does a transform get applied twice if I include vendor prefix alongside regular syntax? -


say have div

<div id='box'></div> 

and in javascript/jquery go:

$('#box').css('transform','translatex(300px)'); $('#box').css('-webkit-transform','translatex(300px)'); 

https://jsfiddle.net/foreyez/7ful77h3/

now can run either (or both) sentences , run on desktop (chrome). on mobile, ios versions requires have -webkit prefix. second 1 work.

therefore include both statements in code. , seems work. i'm wondering if "bad". because maybe it'll try run both transforms, if it's on desktop. not notice, seems work ok can see on fiddle. maybe behind scenes it's bad mojo or something.

and if would better practice determine beforehand if should use "transform" or "-webkit-transform" , run 1 statement -- , if that's case, how determine that? note i'm talking javascript code here (not css). or better run both i'm doing?

you of course this

$('#box').css({    'transform' : 'translatex(300px)',    '-webkit-transform' : 'translatex(300px)' }); 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -