PHP 8.5.2
Preview: script.js Size: 1.42 KB
/home/serveshikshafoundation/htdocs/serveshikshafoundation.org.in/Documentation/js/script.js

(function($) {

	"use strict";


    var sections = $('.section'),
        nav = $('#navbar'),
        nav_height = nav.outerHeight();

    function activeMenuItem() {
        var cur_pos = $(window).scrollTop() + 2;
        sections.each(function() {
            var top = $(this).offset().top - nav_height,
                bottom = top + $(this).outerHeight();

            if (cur_pos >= top && cur_pos <= bottom) {
                nav.find('ul > li > a').parent().removeClass('active');
                nav.find('a[href="#' + $(this).attr('id') + '"]').parent().addClass('active');
            } else if (cur_pos == 2) {
                nav.find('ul > li > a').parent().removeClass('active');
            }
        });
    }

    $(function() {
        $('#navbar > ul > li > a').click(function() {
            if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
                var target = $(this.hash);
                target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
                if (target.length) {
                    $('html, body').animate({
                    scrollTop: target.offset().top - 100
                }, 500);
                    return false;
                }
            }
        });
    });

     $(window).scroll(function() {
        activeMenuItem();
    });



})(window.jQuery);

Directory Contents

Dirs: 0 × Files: 3

Name Size Perms Modified Actions
36.18 KB lrw-r--r-- 2016-07-25 22:53:30
Edit Download
94.89 KB lrw-r--r-- 2016-07-27 18:53:46
Edit Download
1.42 KB lrw-r--r-- 2016-08-14 04:08:22
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).