dollarshaveclub / reframe.js

🖼 Reframe unresponsive elements responsively.

Home Page:https://github.com/yowainwright/reframe.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple selectors prevented from reframing

dougHanson opened this issue · comments

Requested Update

Remove this specific line of code from jquery.reframe.js, which breaks the reframing for-loop if an element has a percentage width:

if (wAttr.indexOf('%') > -1 || frame.style.width.indexOf('%') > -1) return;

Why Is This Update Needed?

I am working on a site which has multiple content Authors, and have come across an instance whereby multiple videos within iFrames were embedded on the page. The first had a percentage width, the others did not. As a result of the above line of code, the responsive wrapping container was not applied to the subsequent iFrames.

Because the first selector has a width attribute set as a percentage, it breaks out of the for-loop which wraps the elements in a responsive wrapper, and no further elements of the current selector get processed.

Since the element is reframed in a responsive container, I don't believe this line of code is necessary. Happy to be proven wrong however :)

Thanks

@dougHanson thanks for catching this problem!

I'm going to do a few tests before publishing a new version. I should be able to release this tomorrow.