var globalFlagDetenerProceso = false; var screenWidth=0; var screenHeight=0; $(document).ready(function(){ //setearDimensionesPantalla(); }); //window.onorientationchange = setearDimensionesPantalla; function setearDimensionesPantalla() { screenWidth = $(window).width(); screenHeight =$(window).height(); /* resultado y otras maneras de obtener las dimensiones: alert( screenWidth+" x "+screenHeight ); alert( window.screen.width+".x."+window.screen.height ); alert( document.documentElement.clientWidth+"-x-"+document.documentElement.clientHeight ); */ window.screen.width; var prgPhp = '/default/php/asentarscreensize/screenWidth/'+screenWidth+'/screenHeight/'+screenHeight; var variablesPost = null; var jsOK = null; var jsERROR = 'alert("ERROR: Ha fallado la carga del tamaño de pantalla.");'; phpYLuegoJavascript( prgPhp, variablesPost, jsOK, jsERROR ); } // tipTipOcultar(); lo tengo definido dentro del jquery de tiptip /* funcion visible() * ( es una opcion a la que está más abajo: estaVisibleEnLaVentana ) * https://github.com/customd/jquery-visible/blob/master/README.markdown * https://github.com/customd/jquery-visible/ * Indica si un objeto está parcial, o totalmente visible. * $("#miObjeto").visible(); devuelve TRUE o FALSE * doc: https://www.customd.com/articles/13/checking-if-an-element-is-visible-on-screen-using-jquery * demo: http://opensource.teamdf.com/visible/examples/demo-basic.html * github: https://github.com/customd/jquery-visible/blob/master/jquery.visible.js * js min: https://github.com/customd/jquery-visible/blob/master/jquery.visible.min.js * * OTRAS MANERAS QUE PUEDEN SERVIR SEGUN CADA CASO: * https://es.stackoverflow.com/questions/33/c%C3%B3mo-puedo-saber-si-un-elemento-est%C3%A1-visible-con-jquery */ !function(t){var i=t(window);t.fn.visible=function(t,e,o){if(!(this.length<1)){var r=this.length>1?this.eq(0):this,n=r.get(0),f=i.width(),h=i.height(),o=o?o:"both",l=e===!0?n.offsetWidth*n.offsetHeight:!0;if("function"==typeof n.getBoundingClientRect){var g=n.getBoundingClientRect(),u=g.top>=0&&g.top0&&g.bottom<=h,c=g.left>=0&&g.left0&&g.right<=f,v=t?u||s:u&&s,b=t?c||a:c&&a;if("both"===o)return l&&v&&b;if("vertical"===o)return l&&v;if("horizontal"===o)return l&&b}else{var d=i.scrollTop(),p=d+h,w=i.scrollLeft(),m=w+f,y=r.offset(),z=y.top,B=z+r.height(),C=y.left,R=C+r.width(),j=t===!0?B:z,q=t===!0?z:B,H=t===!0?R:C,L=t===!0?C:R;if("both"===o)return!!l&&p>=q&&j>=d&&m>=L&&H>=w;if("vertical"===o)return!!l&&p>=q&&j>=d;if("horizontal"===o)return!!l&&m>=L&&H>=w}}}}(jQuery); function estaVisibleEnLaVentana( idObjeto ) { if( idObjeto.indexOf("#") == -1 && idObjeto.indexOf(".") == -1 ){ idObjeto = "#"+idObjeto; } var elemento = $(idObjeto); var posicion = elemento.position(); var left = $(window).scrollLeft(); var right = $(window).scrollLeft() + $(window).width(); var top = $(window).scrollTop(); var fold = $(window).height() + $(window).scrollTop(); var visibilidad_izquierda = ( left <= posicion.left )? true : false ; var visibilidad_derecha = ( right >= ( posicion.left + elemento.width() ) )? true : false ; var visibilidad_top = ( top <= posicion.top )? true : false ; var visibilidad_bottom = ( fold >= posicion.top + elemento.height() )? true : false ; if( visibilidad_izquierda && visibilidad_derecha && visibilidad_top && visibilidad_bottom ){ return true; }else{ return false; } } function copiarDivToVar( divOrigen, varDestino ) { if( !$("#"+divOrigen ).length ){ return; } window[varDestino] = $('#'+divOrigen ).html(); //window[varDestino] = $('#'+divOrigen ).contents(); //window[varDestino] = document.getElementsByTagName("div")[x].innerHTML; } function siExisteTomarDesdeAhi( jsLoadAEjecutar, divDestino, varConContenidoDiv ) { if( typeof window[varConContenidoDiv] != "undefined" ){ $('#'+divDestino).html( window[varConContenidoDiv] ); }else{ eval( jsLoadAEjecutar ); copiarDivToVar( divDestino, varConContenidoDiv ); } } function confirmar( mensaje ) { var quiereContinuar = confirm( mensaje ); if(!quiereContinuar){ globalFlagDetenerProceso = true; } return quiereContinuar; /*window.location=""url*/ } function ocultar( capaId ) { $('#'+capaId).hide(); } function cerrar( capaId ) { $('#'+capaId).remove(); } function putOverlay( opacidad_1_en_100 ) { if( $('#divOverlay').length ){ return; } var ancho= $('html').width(); var alto = $('html').height(); if(!opacidad_1_en_100){ opacidad_1_en_100 = 50; } $('#divOverlay').hide(); var divOverlay = "
 
"; //var auxDivDestino = ( document.getElementById( "contenedor_derecha" ) ) ? "#contenedor_derecha" : "body"; // $(auxDivDestino).append( divOverlay ); $('html').append( divOverlay ); $('#divOverlay').width(ancho); $('#divOverlay').height(alto); $('#divOverlay').show(); //$('#divOverlay').fadeIn(300); } function closeOverlay() { $('#divOverlay').fadeOut(400, function(){ $('#divOverlay').remove(); } ); //$('#divOverlay').hide(1000); } function cerrarmiPopupDesdeOverlay() { $("#divOverlay").click( function(){ miPopupCerrar(); }); } /* El código javascript para esta fn sería algo como: window.scrollTo({ top: 250, behavior: 'smooth', }); */ function scrollHastaUnaDiv( div, retroceso ) { var retroceso = (!retroceso)? 50 : retroceso; if( $("#"+div).length ){ //if( $("#"+div).hasOwnProperty("offset") ){ $('html,body').animate({ scrollTop: (( $("#"+div).offset().top )-retroceso)}, 'slow'); //} } } function ventanaPopup( titulo, htmlInterior, javascript, onCloseGif, usarOverlay, designWin, imageBGparaTexto, gifNumero ) { ocultarMiTipTip(); var usarOverlay = ( !usarOverlay || usarOverlay == undefined) ? true : usarOverlay; var designWin = ( !designWin || designWin == 1 ) ? 1 : designWin; var divWin = 'miPopup'; if( !titulo ) { var titulo = ''; } if( !htmlInterior ) { var htmlInterior = ''; } if( !javascript ) { var javascript = ''; } javascript = javascript + ";cerrarmiPopupDesdeOverlay();"; if( !onCloseGif ) { var onCloseGif = ''; } if( !imageBGparaTexto ) { var imageBGparaTexto = ''; } if( !gifNumero) { var gifNumero = 1; } if( $('#'+divWin).length ){ return actualizarPopup( titulo, htmlInterior, javascript, onCloseGif, usarOverlay, designWin, gifNumero ); } if( usarOverlay ){ var opacidadOverlay = ( isNumber( usarOverlay ) )? usarOverlay : 50; putOverlay( opacidadOverlay ); } if( htmlInterior == 'loading' ){ var colocarLoadingGif = 'true'; var htmlInterior = ''; onCloseGif = 'false'; }else{ var colocarLoadingGif = 'false'; } var onCloseGifJavascript = (divWin=='miPopup')? 'miPopupCerrar();return false;' : 'cerrar("'+divWin+'");closeOverlay();return false;'; if( onCloseGif == 'false' ){ var onCloseGifStyle = 'float:right; display:none'; }else{ var onCloseGifStyle = 'display:visible;float:right;margin-left:20px;z-index:1000;'; if( onCloseGif == 'true' ) { onCloseGif='';} if( onCloseGif != '' ){ var onCloseGifJavascript = onCloseGif + onCloseGifJavascript; } } var html = ''; html += "
"; html += "
" + titulo + "
"; html += "
"; html += ""; html += "