- if( $('#header').css('position') === 'fixed' ){
-
- // Jump to the given ID
- var jump = function( id ){
- if( $('#'+id).length == 0 ) return false;
-
- document.location.href = document.location.href.replace(/#.+/,'') + '#' + id;
-
- $('html,body').animate({
- scrollTop: $('#'+id).position()['top'] - $('#header').height() - $('.navigation.fixed').height() -5
- }, 100);
-
- return true;
- };
-
- var uri = document.location.pathname;
- var uri_end = uri.replace(/^.*\//,'');
-
- // Page load
- if( document.location.href.match(/#./) ) jump( document.location.href.replace(/^.*#(.+)$/,'$1') );
-
- // Anchor click
- $('a').live('click', function(e){
- var href = $(this).attr('href');
- if( !href.match(/^.*#.+$/) ) return true; // No # in the anchor
-
- var href_uri = href.replace(/^([^#]*)(#.*)?/,'$1'); // href without the #
-
- if( href_uri.match(/^([a-z]+:)?\/\//) ) return true; // Ignore full URLs
- if( href_uri.match(/^[^\/]/) && href_uri != uri_end ) return true; // Ignore relative links to other pages
- if( href_uri.match(/^\//) && href_uri != uri ) return true; // Ignore absolute links to other pages
-
- if( jump( href.replace(/^.*#(.+)$/,'$1') ) ) e.preventDefault();
- });
-
- // For browsers which support it, detect when the hash in the address bar changes
- $(window).bind('hashchange',function(e){
- if( jump( document.location.href.replace(/^.*#(.+)$/,'$1') ) ) e.preventDefault();
- });
- }
-
+if ($('#header').css('position') === 'fixed') {
+
+ // Jump to the given ID
+ var jump = function (id) {
+ if ($('#' + id).length == 0) return false;
+
+ document.location.href = document.location.href.replace(/#.+/, '') + '#' + id;
+
+ $('html,body').animate({
+ scrollTop: $('#' + id).position()['top'] - $('#header').height() - $('.navigation.fixed').height() - 5
+ }, 100);
+
+ return true;
+ };
+
+ var uri = document.location.pathname;
+ var uri_end = uri.replace(/^.*\//, '');
+
+ // Page load
+ if (document.location.href.match(/#./)) jump(document.location.href.replace(/^.*#(.+)$/, '$1'));
+
+ // Anchor click
+ $('a').live('click', function (e) {
+ var href = $(this).attr('href');
+ if (!href.match(/^.*#.+$/)) return true; // No # in the anchor
+ var href_uri = href.replace(/^([^#]*)(#.*)?/, '$1'); // href without the #
+ if (href_uri.match(/^([a-z]+:)?\/\//)) return true; // Ignore full URLs
+ if (href_uri.match(/^[^\/]/) && href_uri != uri_end) return true; // Ignore relative links to other pages
+ if (href_uri.match(/^\//) && href_uri != uri) return true; // Ignore absolute links to other pages
+ if (jump(href.replace(/^.*#(.+)$/, '$1'))) e.preventDefault();
+ });
+
+ // For browsers which support it, detect when the hash in the address bar changes
+ $(window).bind('hashchange', function (e) {
+ if (jump(document.location.href.replace(/^.*#(.+)$/, '$1'))) e.preventDefault();
+ });
+}
\ No newline at end of file