function v(str){ if(window.console && console.log){ console.log(str) } } function art_slideshow_next_clicked(index, width, max, maxItem){ var current_page = $(this).parent().parent().parent().children(".art_slideshow_content").children(".slideshow_img_container:first").position().left/width; if(current_page < 0) current_page = -current_page; v($(this).parent().parent().parent().children(".art_slideshow_content").children(".slideshow_img_container:first").position().left); v(width); v(max); if(index == -1) { if($(this).parent().parent().parent().children(".art_slideshow_content").children(".slideshow_img_container:first").position().left < 0) { // move to left art_slideshow_move(current_page, current_page-1, width, maxItem, $(this)); } } else { if($(this).parent().parent().parent().children(".art_slideshow_content").children(".slideshow_img_container:first").position().left - width > -max) { // move to right art_slideshow_move(current_page, current_page+1, width, maxItem, $(this)); } } } function art_slideshow_move(from, to, width, maxItem, but){ if(to < from) { var diff = width*(from-to); but.parent().parent().parent().children(".art_slideshow_content").children(".slideshow_img_container").animate({left : "+=" + diff + "px"}); } else if(to > from) { var diff = width*(to-from); but.parent().parent().parent().children(".art_slideshow_content").children(".slideshow_img_container").animate({left : "-=" + diff + "px"}); } $(".slideshow_dot.current_dot").eq(0).toggleClass("current_dot"); $(".slideshow_dot").eq(to).toggleClass("current_dot"); v(to); if (to == 4) $("#airlineairportpartners").html("Airport Partners"); else $("#airlineairportpartners").html("Airline Partners"); if (to == 0) $(".img_arrowL").css("display", "none"); else $(".img_arrowL").css("display", "block"); if (to == 4) $(".img_arrowR").css("display", "none"); else $(".img_arrowR").css("display", "block"); } function slideshow_page_clicked(page_dot){ var index= $(page_dot).eq(0).attr("value"); index -= 1; var oldIndex = $(".slideshow_dot.current_dot").eq(0).attr("value"); oldIndex = oldIndex-1; diff = (index-oldIndex) * 750; $(page_dot).parent().parent().children(".art_slideshow_content").children(".slideshow_img_container").animate({left : "-=" + diff + "px"}); $(".slideshow_dot.current_dot").eq(0).toggleClass("current_dot"); $(".slideshow_dot").eq(index).toggleClass("current_dot"); v(index); if (index == 4) $("#airlineairportpartners").html("Airport Partners"); else $("#airlineairportpartners").html("Airline Partners"); if (index == 0) $(".img_arrowL").css("display", "none"); else $(".img_arrowL").css("display", "block"); if (index == 4) $(".img_arrowR").css("display", "none"); else $(".img_arrowR").css("display", "block"); } function setIndexBannerLink(index, ele){ var banner_link = ele.data('link'); var link_open_in = ele.data('openin') if(link_open_in=="" || link_open_in == undefined){ link_open_in = "_self"; } //console.log(index+": "+banner_link); if(banner_link=="" || banner_link == undefined){ $("#index_banner_link").hide(); }else{ $('#index_banner_link a').attr({"href": banner_link, "target": link_open_in}); $("#index_banner_link").show(); } } $(function(){ var time = 5000, timer = null, slide_time=1200; setIndexBannerLink(0, $('#banner div.active')); timer = setInterval(function(){ $('#index_banner_arrowR').trigger('click.arrowR'); },time); $('#index_banner_arrowL').click(function(){ var total = $('#banner div').size(); var index = $('#banner div').index($('#banner div.active')); if (total > 1) { if(index > -1){ $('div.active').removeClass('active'); if(index > 0){ prev_banner_idx = index-1; } else { prev_banner_idx = total-1; } setIndexBannerLink(prev_banner_idx, $('#banner div:eq('+prev_banner_idx+')')); $('#banner div:eq('+index+')').stop(1,1).fadeOut(slide_time); $('#banner div:eq('+prev_banner_idx+')').addClass('active').stop(1,1).fadeIn(slide_time); } clearInterval(timer); timer = setInterval(function(){ $('#index_banner_arrowR').trigger('click.arrowR'); },time); } }); $('#index_banner_arrowR').bind('click.arrowR',function(){ var total = $('#banner div').size(); var index = $('#banner div').index($('#banner div.active')); if (total > 1) { if(index > -1){ $('div.active').removeClass('active'); if(total > index + 1){ next_banner_idx = index+1; } else { next_banner_idx = 0; } setIndexBannerLink(next_banner_idx, $('#banner div:eq('+next_banner_idx+')')); $('#banner div:eq('+index+')').stop(1,1).fadeOut(slide_time); $('#banner div:eq('+next_banner_idx+')').addClass('active').stop(1,1).fadeIn(slide_time); } clearInterval(timer); timer = setInterval(function(){ $('#index_banner_arrowR').trigger('click.arrowR'); },time); } }); });