globals = { slider_started: false } $(window).bind('beforeunload', function(){ $('#transition-wrapper').fadeIn(100); }); $( function(){ $(this).bind("contextmenu", function(e) { e.preventDefault(); }); $('.colorbox').colorbox(); if( $(window).width() > 767 ){ $('.marquee div').mouseenter( function(){ $(this).find('h3').stop().fadeIn(); /* new_src = $(this).find('img').attr('src'); new_src = new_src.replace( 'cities', 'cities (colori)' ); $(this).find('img').attr('src', new_src); */ }).mouseleave( function(){ $(this).find('h3').stop().fadeOut(); /* new_src = $(this).find('img').attr('src'); new_src = new_src.replace( 'cities (colori)', 'cities' ); $(this).find('img').attr('src', new_src); */ }); } }); function start_slider(){ if( !globals.slider_started ){ slider = $('.bxslider').bxSlider({ captions: true, mode: 'horizontal', auto: true, pause: 7000, speed: 1000, onSliderLoad: function(){ //$('.bx-wrapper p').css('top', $(window).height()/2 + $(window).height()/2/100*25 ); $('.bx-wrapper p.slide1').hide().fadeIn(2000) //slide_text( 1 ); }, onSlideAfter: function(slide, old_idx, new_idx){ //Replace current class with next //$('.navbar-static-top').removeClass('slide'+new_idx).addClass('slide'+idx); $('.bx-wrapper p.slide'+(new_idx+1)).fadeIn(2000); }, onSlideBefore: function(slide, old_idx, new_idx){ //slide_text( new_idx+1 ); $('.bx-wrapper p.slide'+(new_idx+1)).hide(); } }); } globals.slider_started = true; } function slide_text( idx ){ $('.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 = $('.int_photo img'); var highest = 0; photos.each(function(){ var $photo = $(this); var zindex = $photo.css('z-index'); if( parseInt(zindex) > highest ){ highest = zindex; } }); return parseInt( highest ); }