Posted By

cessnajumpin on 11/17/11


Tagged

css jquery integer


Versions (?)

jquery css values to integers


 / Published in: jQuery
 

A quick snippet that removes the 'px' when accessing a value through jquery, and converts it into an integer.

  1. parseInt($('.element-class').css('width').replace(/[^-\d\.]/g, ''));
  2.  
  3. Usage would be:
  4.  
  5. var totalWidth = parseInt($('.portfoliowrapper').css('width').replace(/[^-\d\.]/g, ''));

Report this snippet  

You need to login to post a comment.