Buongiorno a tutti sto provando a risolvere un problema con l'evento orientationchange, nel dettaglio vorrei gestire il passaggio da smartphone e tablet da verticale a orizzontale con javascript per gestire anche alcune funzioni in seguito ma il fatto è che da android non riesco a gestite con jquery neanche un paio di animazioni e i metodi hide e show, dico da android perchè con il mio iphone va tutto bene ma quando faccio i test con android non riconosce bene l'evento orientationchange in quanto confonde il portrait con landscape ecco il mio codice js:
Grazie per l'aiuto per qualunque cosa sono a disposizione buona giornata.Codice:<script> jQuery(document).ready(function(){ /* Ipostazioni se cambia l'orientamento del monitor da smartphone o tablet */ jQuery(window).on("orientationchange",function(){ /* Smartphon e Tablet */ if( jQuery(window).height() > jQuery(document).width() ){ /* Smartphon */ if( jQuery(window).height() <= 600 ){ /* Se il valore è uguale a zero è in verticale */ if(window.orientation == 0){ var altezza = jQuery(window).height() / 100 ; jQuery('#tourDIV').css('height', altezza * 80 + 'px' ); jQuery('.colonna-dx').show(); jQuery('.thumbnailsDIV').show(); jQuery('.thumbnailsDIV').animate({height: altezza * 20 + 'px'}); jQuery('.thumbnailsDIV div').animate({height: altezza * 17.5 + 'px'}); jQuery('.thumbnailsDIV div').animate({width: altezza * 37.4 + 'px'}); jQuery('.stanzaDIV').animate({height: altezza * 17.5 + 'px'}); jQuery('.stanzaDIV').animate({width: altezza * 37.4 + 'px'}); jQuery('.stanzaDIV').animate({lineHeight: altezza * 17.5 + 'px'}); alert('verticale'); } else{ alert('landscape'); var altezza = jQuery(window).height() / 100 ; jQuery('#tourDIV').css('height', altezza * 100); jQuery('.colonna-dx').hide(); jQuery('.thumbnailsDIV').hide(); } } /* Tablet */ if( jQuery(window).height() <= 1000 && jQuery(window).height() > 600 ){ if(window.orientation == 0){ var altezza = jQuery(window).height() / 100 ; jQuery('#tourDIV').css('height', altezza * 84 + 'px' ); jQuery('.colonna-dx').show(); jQuery('.thumbnailsDIV').show(); jQuery('.thumbnailsDIV').animate({height: altezza * 16 + 'px'}); jQuery('.thumbnailsDIV div').animate({height: altezza * 13.7 + 'px'}); jQuery('.thumbnailsDIV div').animate({width: altezza * 27.4 + 'px'}); jQuery('.stanzaDIV').animate({height: altezza * 13.7 + 'px'}); jQuery('.stanzaDIV').animate({width: altezza * 27.4 + 'px'}); jQuery('.stanzaDIV').animate({lineHeight: altezza * 13.7 + 'px'}); alert('verticale'); } else{ alert('landscape'); var altezza = jQuery(window).height() / 100 ; jQuery('#tourDIV').css('height', altezza * 100); jQuery('.colonna-dx').hide(); jQuery('.thumbnailsDIV').hide(); } } } }); </script>

LinkBack URL
About LinkBacks

