(function($){ $(document).ready(function(){ $('#main>div').each(function(){ $(this).css({'height':'0', 'overflow':'hidden'}) }); $("#main #Home").css("height", "auto"); //$(".single_page_wrapper").css("clear", "both"); $(".single_page_wrapper .single_page").css("overflow", "inherit"); //var header_elemint = Drupal.settings.single_page.header_element; //var footer_element = Drupal.settings.single_page.footer_element; var menu_element = Drupal.settings.single_page.menu_element; var content_element = Drupal.settings.single_page.content_element; $(menu_element + " li:first").addClass("active"); $(menu_element + " li:first a").addClass("active"); var target_offset = $(".single_page_wrapper:first").offset(); var target_top = target_offset.left; $('html, body').animate({scrollLeft:target_top}, 500); var anchor = location.hash; if(anchor != ""){ var current_item = $(anchor); var index = $("div.single_page_wrapper").index(current_item); $(menu_element + " li").removeClass("active"); $(menu_element + " li a").removeClass("active"); $(menu_element + " li:eq(" + index + ")").addClass("active"); $(menu_element + " li:eq(" + index + ") a").addClass("active"); var target_offset = $(anchor).offset(); var target_top = target_offset.left; $('html, body').animate({scrollLeft:target_top}, 500); } $(menu_element+" a").click(function(event){ $(menu_element + " li").removeClass("active"); $(menu_element + " li a").removeClass("active"); $(this).addClass("active"); $(this).parent().addClass("active"); //prevent the default action for the click event event.preventDefault(); //get the full url - like mysitecom/index.htm#home var full_url = this.href; //split the url by # and get the anchor target name - home in mysitecom/index.htm#home var parts = full_url.split("#"); var trgt = parts[1]; //get the top offset of the target anchor var target_offset = $("#"+trgt.replace(" ", "_")).offset(); var target_width = $("#"+trgt.replace(" ", "_")).width(); var target_top = target_offset.left; //window.location.hash = "#"+trgt.replace(" ", "_"); //goto that anchor by setting the body scroll top to anchor top var window_width = $(window).width(); target_top = target_top -(window_width - target_width)/2; $('html, body').animate({scrollLeft:target_top}, 700); var active_id = '#'+trgt; var active_height = $(active_id).find('.single_page').height(); $('#main>div').each(function(){ $(this).css({'height': active_height, 'overflow':'hidden', 'min-height':'320'}) }); //$(active_id).css('height', active_height); }); $("a.content_link").click(function(event){ $(menu_element + " li").removeClass("active"); $(menu_element + " li a").removeClass("active"); $(this).addClass("active"); $(this).parent(trgt).addClass("active"); //prevent the default action for the click event event.preventDefault(); //get the full url - like mysitecom/index.htm#home var full_url = this.href; //split the url by # and get the anchor target name - home in mysitecom/index.htm#home var parts = full_url.split("#"); var trgt = parts[1]; //get the top offset of the target anchor var target_offset = $("#"+trgt.replace(" ", "_")).offset(); var target_width = $("#"+trgt.replace(" ", "_")).width(); var target_top = target_offset.left; //window.location.hash = "#"+trgt.replace(" ", "_"); //goto that anchor by setting the body scroll top to anchor top var window_width = $(window).width(); target_top = target_top -(window_width - target_width)/2; $('html, body').animate({scrollLeft:target_top}, 700); var active_id = '#'+trgt; var active_height = $(active_id).find('.single_page').height(); $('#main>div').each(function(){ $(this).css({'height': active_height, 'overflow':'hidden', 'min-height':'320'}) }); //$(active_id).css('height', active_height); //Add class using inside link $('#main-menu-links a').each(function(){ var outsideLink = this.href.split("#"); if((trgt == outsideLink[1])){ $(this).addClass('active'); $(this).parent().addClass("active"); } }); }); var monitorWidth = $(window).width(); var blockMargin = (monitorWidth - $('.single_page_wrapper').width())/2; $('.single_page_wrapper').each(function(){ if(blockMargin > 0){ $(this).css({ 'margin-left' : blockMargin, 'margin-right' : blockMargin}); } }); $(".content_link").tipsy({gravity: 'nw', offset: 5, fade: true}); $(".info").tipsy({gravity: 'w', offset: 5, fade: true}); $("#drupal_logo").tipsy({gravity: 'w', offset: 5, fade: true}); $("span#underlined").tipsy({gravity: 'nw', offset: 5, fade: true}); $("a#label").tipsy({gravity: 'w', offset: 0, fade: true}); $("#sprite").tipsy({gravity: 'w', offset: 30, fade: true, html: true}); $("a.colorbox-node").colorbox(); $(function(){ $("#map").hover( function(){ $(this).animate({width: '97.8%'}); }, function(){ $(this).animate({width: '30%'}); } ); }); }); })(jQuery);