/[svn]/doc/tmpl/js/crd.js
ViewVC logotype

Diff of /doc/tmpl/js/crd.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3265 by schoenebeck, Sun Apr 26 20:54:00 2015 UTC revision 3266 by schoenebeck, Thu Jun 1 13:13:27 2017 UTC
# Line 1  Line 1 
1  /*  /*
2    CrudeDoc Java Script    CrudeDoc Java Script
3    Copyright (c) 2015 Christian Schoenebeck. All rights reserved.    Copyright (c) 2015 - 2017 Christian Schoenebeck. All rights reserved.
4    http://www.crudebyte.com    http://www.crudebyte.com
5  */  */
6    
# Line 14  function crdScrollTo(e) { Line 14  function crdScrollTo(e) {
14      $('html, body').animate({      $('html, body').animate({
15          scrollTop: $( "#" + $(e).attr("section") ).offset().top - 68          scrollTop: $( "#" + $(e).attr("section") ).offset().top - 68
16      }, 300);      }, 300);
17        var obj = $( "#" + $(e).attr("section") );
18        $(obj).fadeIn(100).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(120).fadeOut(100).fadeIn(120);
19    }
20    
21    function crdScrollToHash(h) {
22        if (typeof h === 'undefined') {
23            h = location.hash;
24            if (!h || h.length < 2) return;
25        }
26        $('html, body').animate({
27            scrollTop: $( h ).offset().top - 68
28        }, 300);
29        $(h).fadeIn(100).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(120).fadeOut(100).fadeIn(120);
30  }  }
31    
32  function crdOnScroll() {  function crdOnScroll() {
# Line 69  $(function() { Line 82  $(function() {
82      $(window).resize(function() {      $(window).resize(function() {
83          crdOnWindowResize();          crdOnWindowResize();
84      });      });
85        if ("onhashchange" in window) {
86            window.onhashchange = function() {
87                crdScrollToHash();
88            };
89        }
90        $("article a[href]").each(function() {
91            var href = $(this).attr("href");
92            if (href && href.length > 1 && href.charAt(0) == '#') {
93                $(this).click(function(e) {
94                    var anch = $(this).attr("href");
95                    crdScrollToHash(anch);
96                });
97            }
98        });
99  });  });
100    
101  $(document).ready(function() {  $(document).ready(function() {
102      crdOnWindowResize();      crdOnWindowResize();
103        crdScrollToHash();
104  });  });
105    
106  var _crdScrollTimeout;  var _crdScrollTimeout;

Legend:
Removed from v.3265  
changed lines
  Added in v.3266

  ViewVC Help
Powered by ViewVC