Is there a way to ensure that events in the AFTER when changechange event (jQuery Mobile, JavaScript) are changed?

I have an issue with iOS, specifically iPhone, where my jQuery Mobile web app fires a window resize event BEFORE the jQuery Mobile asynchronous event. I haven't seen this happening on Android in my testing, at this point (which means it could spring later). Is there a way to ensure that the resize event changes after the changechange event, perhaps using window.orientation?

Thank.

+1


source to share


2 answers


Good news and bad news. Bad news: no, you can't guarantee it. These errors were from the very beginning and are still not fully developed. I wouldn't expect them to come soon, and I don't expect other platform competitors to implement them correctly as they rush to enter the market with less overhead.

The good news is that you probably don't even need javascript events. There's a very good chance that you can accomplish whatever you want to do with CSS Media Queries and do it more reliably.



/* Regular mobile styles */
.logo-large{
    background-image:url(../images/logo.png);
    background-repeat:no-repeat;
    background-position:0 0;
    position:relative;
    top:0;
    left:0;
    width:290px;
    height:65px; 
    margin:0 auto; 
    border:none;
}



/* Horizontal */
@media all and (min-width: 480px){
    /* put your horizontal stylings here */
}

/* HD / Retina */
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
       only screen and (min--moz-device-pixel-ratio: 1.5),
       only screen and (min-resolution: 240dpi) {
    .logo-large{
        background-image:url(../images/logoHD.png);background-size:290px 65px;
    }
}


/* iPad */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {

}

      

+1


source


You can set a timeout to wait for the changechange event

IT WORKS



   $(window).bind('resize', function() { setTimeout( function() { messageToNativeApp('screen_resized'); }, 500); });

      

0


source







All Articles