CSS Background position parse


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function getBackgroundPositionX(value){
  2.  
  3. if(!$(value).css('backgroundPosition')) {
  4. //ie fix
  5. backPos = $(value).css('background-position-x');
  6. posX = Number(backPos.split("px")[0]);
  7. } else {
  8. backPos = $(value).css('backgroundPosition').split(" ");
  9. posX = Number(backPos[0].split("px")[0]);
  10. }
  11.  
  12. return posX;
  13. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.