Using jquery 3.0.0when setting the width of an element:
- iframe.width(100px) ;
this will work correctly.
but if your code within a window.resize function looks like this:
- iframe.width(100px);
- iframe.css('padding', 2*10);
then the iframe will grab the
padding & border, and the end CSS will look like this:
- width: 142.667px;
- padding: 20px;
JS code:
- $(window).resize(function () {
- var frame = $('iframe');
- frame.width(100);
- frame.css('padding', (20));
- });
HTML:
- <iframe></iframe>