globals = { slider_started: false } jQuery(window).bind('beforeunload', function(){ jQuery('#transition-wrapper').fadeIn(100); }); jQuery( function(){ jQuery('.colorbox').colorbox(); jQuery('a[href^="#"]').on('click',function (e) { e.preventDefault(); var target = this.hash; var $target = jQuery(target); jQuery('html, body').stop().animate({ 'scrollTop': $target.offset().top }, 900, 'swing'); }); if( jQuery(window).width() > 767 ){ jQuery('.marquee div').mouseenter( function(){ jQuery(this).find('h3').stop().fadeIn(); /* new_src = jQuery(this).find('img').attr('src'); new_src = new_src.replace( 'cities', 'cities (colori)' ); jQuery(this).find('img').attr('src', new_src); */ }).mouseleave( function(){ jQuery(this).find('h3').stop().fadeOut(); /* new_src = jQuery(this).find('img').attr('src'); new_src = new_src.replace( 'cities (colori)', 'cities' ); jQuery(this).find('img').attr('src', new_src); */ }); } jQuery('[data-link]').click( function(){ location.href = jQuery(this).data('link'); }); }); function start_slider(){ if( !globals.slider_started ){ slider = jQuery('.bxslider').bxSlider({ captions: true, mode: 'horizontal', auto: true, pause: 7000, speed: 1000, onSliderLoad: function(){ //jQuery('.bx-wrapper p').css('top', jQuery(window).height()/2 + jQuery(window).height()/2/100*25 ); jQuery('.bx-wrapper p.slide1').hide().fadeIn(2000) //slide_text( 1 ); }, onSlideAfter: function(slide, old_idx, new_idx){ //Replace current class with next //jQuery('.navbar-static-top').removeClass('slide'+new_idx).addClass('slide'+idx); jQuery('.bx-wrapper p.slide'+(new_idx+1)).fadeIn(2000); }, onSlideBefore: function(slide, old_idx, new_idx){ //slide_text( new_idx+1 ); jQuery('.bx-wrapper p.slide'+(new_idx+1)).hide(); } }); } globals.slider_started = true; } function slide_text( idx ){ jQuery('.bx-wrapper p').stop().css('top', '20%').animate({ 'top': '30%' }, 8000); } function getCurrentPage( url ){ page = url; re = /(.+)\/(.+)$/g; complete_url = page.replace(re,"$2"); //tolgo il parametro lang re = /(.+)&lang=[a-z]{2}/g; complete_url = complete_url.replace( re, "$1" ); complete_url = complete_url.replace( /#.*/, '' ); return complete_url; } function findHighestZIndex(){ var photos = jQuery('.int_photo img'); var highest = 0; photos.each(function(){ var $photo = jQuery(this); var zindex = $photo.css('z-index'); if( parseInt(zindex) > highest ){ highest = zindex; } }); return parseInt( highest ); }