rodneyrehm / viewport-units-buggyfill

Making viewport units (vh|vw|vmin|vmax) work properly in Mobile Safari.
MIT License
1.59k stars 151 forks source link

Custom event for processing needed #62

Closed henryruhs closed 9 years ago

henryruhs commented 9 years ago

Hello,

old Android browsers usually have render issues while applying the viewport units hack.

For that reason I like to hide parts and show them once the hack was completed. Can you provide a custom event like viewportUnitsBuggyfillPatched that triggers on window? Maybe other events are usefull too?

At the moment I obeserve the #patched-viewport what is kind of bad.

$('#patched-viewport').on('DOMNodeInserted', function () {
    alert('viewportUnitsBuggyfillPatched');
});

Thank you

rodneyrehm commented 9 years ago

You're welcome to send a pull request for this. You'd likely want a CustomEvent called viewport-units-buggyfill-style to be emitted in the updateStyles() method.

henryruhs commented 9 years ago

Pull request send!

It would be great to have custom viewport-units-buggyfill-init too but I don't know the right place were to put it to...

That way I can do things like:

$(window).on('viewport-units-buggyfill-init viewport-units-buggyfill-style', function (event) {
    if (event.type === 'viewport-units-buggyfill-init') {
    //add buggy class to hide something
    } else {
    //remove buggy class to hide something
    }
});
rodneyrehm commented 9 years ago

released v0.5.5