' }); }); } PG_Leadgen_Script_Defer(PG_Leadgen_Script_Loader);
" ) .appendTo( 'body' ); $overlay = jQuery( "
" ).hide() .appendTo( 'body' ); var tve_close_lb = function () { $lightbox.hide(); $overlay.hide(); }; /* set listeners for closing the lightbox */ jQuery( document ).on( "click", ".tve_close_lb", tve_close_lb ); jQuery( document ).on( "click", "#tve_zoom_overlay", tve_close_lb ); jQuery( document ).on( "keyup", function ( e ) { if ( e.keyCode == 27 ) { tve_close_lb(); } } ); jQuery( window ).resize( function () { var _sizes = $lightbox.data( "data-sizes" ), windowWidth = window.innerWidth, windowHeight = window.innerHeight, resizeScale = windowWidth windowWidth * resizeScale || _sizes.originalHeight > windowHeight * resizeScale ) { var widthPercent = _sizes.originalWidth / windowWidth, heightPercent = _sizes.originalHeight / windowHeight; _sizes.width = ((widthPercent > heightPercent) ? (windowWidth * resizeScale) : (windowHeight * resizeScale * (_sizes.originalWidth / _sizes.originalHeight))); _sizes.height = ((widthPercent > heightPercent) ? (windowWidth * resizeScale * (_sizes.originalHeight / _sizes.originalWidth)) : (windowHeight * resizeScale)); } $lightbox.width( _sizes.width ); $lightbox.height( _sizes.height ); $lightbox.css( "margin-left", - (_sizes.width + 30) / 2 ); $lightbox.css( "margin-top", - (_sizes.height + 30) / 2 ); } ); } $lightbox.data( "data-sizes", img_size ); jQuery( "#tve_zoom_image_content" ).html( "" ); $lightbox.css( { left: offset.left + target_w / 2, top: offset.top + target_h / 2, marginLeft: 0, marginTop: 0, width: 0, height: 0, opacity: 0 } ).animate( { opacity: 1, left: '50%', top: '50%', marginLeft: - (img_size.width + 30) / 2, marginTop: - (img_size.height + 30) / 2, width: img_size.width, height: img_size.height }, 150 ); $overlay.fadeIn( 150 ); } return false;};