Difference between revisions of "Template:Washington"

Line 275: Line 275:
 
     <!-- End of CSS -->
 
     <!-- End of CSS -->
 
     <head>
 
     <head>
         <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+
         <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
     </head>
+
      
    <script type="text/javascript">
+
<script>
 +
$(function() {
 +
  $('a[href*=#]:not([href=#])').click(function() {
 +
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
  
$(document).ready(function() {
+
      var target = $(this.hash);
  function filterPath(string) {
+
      target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
  return string
+
      if (target.length) {
    .replace(/^\//,'')
+
        $('html,body').animate({
    .replace(/(index|default).[a-zA-Z]{3,4}$/,'')
+
          scrollTop: target.offset().top
    .replace(/\/$/,'');
+
        }, 1000);
  }
+
        return false;
  var locationPath = filterPath(location.pathname);
+
      }
  var scrollElem = scrollableElement('html', 'body');
+
    }
+
  });
  $('a[href*=#]').each(function() {
+
});
    var thisPath = filterPath(this.pathname) || locationPath;
+
</script>
    if (  locationPath == thisPath
+
</head>
    && (location.hostname == this.hostname || !this.hostname)
+
    && this.hash.replace(/#/,'') ) {
+
      var $target = $(this.hash), target = this.hash;
+
      if (target) {
+
        var targetOffset = $target.offset().top;
+
        $(this).click(function(event) {
+
          event.preventDefault();
+
          $(scrollElem).animate({scrollTop: targetOffset}, 400, function() {
+
            location.hash = target;
+
          });
+
        });
+
      }
+
    }
+
  });
+
+
  // use the first element that is "scrollable"
+
  function scrollableElement(els) {
+
    for (var i = 0, argLength = arguments.length; i
+
        <argLength; i++) {
+
      var el = arguments[i],
+
          $scrollElement = $(el);
+
      if ($scrollElement.scrollTop()> 0) {
+
        return el;
+
      } else {
+
        $scrollElement.scrollTop(1);
+
        var isScrollable = $scrollElement.scrollTop()> 0;
+
        $scrollElement.scrollTop(0);
+
        if (isScrollable) {
+
          return el;
+
        }
+
      }
+
    }
+
    return [];
+
  }
+
+
});
+
 
+
 
+
        </script>
+
 
         <!-- Start of the template html elements. -->
 
         <!-- Start of the template html elements. -->
 
         <div id ="mainContainer">
 
         <div id ="mainContainer">

Revision as of 05:45, 11 September 2015