Server IP : 127.0.0.2 / Your IP : 18.222.25.95 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/public/template/js/ |
Upload File : |
(function ($, window, document, undefined) { var OnePageNav = function (elem, options) { this.elem = elem; this.$elem = $(elem); this.options = options; this.metadata = this.$elem.data('plugin-options'); this.$win = $(window); this.sections = {}; this.didScroll = !1; this.$doc = $(document); this.docHeight = this.$doc.height() }; OnePageNav.prototype = { defaults: { navItems: 'a', currentClass: 'current', changeHash: !1, easing: 'swing', filter: '', scrollSpeed: 750, scrollThreshold: 0.5, begin: !1, end: !1, scrollChange: !1 }, init: function () { this.config = $.extend({}, this.defaults, this.options, this.metadata); this.$nav = this.$elem.find(this.config.navItems); if (this.config.filter !== '') { this.$nav = this.$nav.filter(this.config.filter) } this.$nav.on('click.onePageNav', $.proxy(this.handleClick, this)); this.getPositions(); this.bindInterval(); this.$win.on('resize.onePageNav', $.proxy(this.getPositions, this)); return this }, adjustNav: function (self, $parent) { self.$elem.find('.' + self.config.currentClass).removeClass(self.config.currentClass); $parent.addClass(self.config.currentClass) }, bindInterval: function () { var self = this; var docHeight; self.$win.on('scroll.onePageNav', function () { self.didScroll = !0 }); self.t = setInterval(function () { docHeight = self.$doc.height(); if (self.didScroll) { self.didScroll = !1; self.scrollChange() } if (docHeight !== self.docHeight) { self.docHeight = docHeight; self.getPositions() } }, 250) }, getHash: function ($link) { return $link.attr('href').split('#')[1] }, getPositions: function () { var self = this; var linkHref; var topPos; var $target; self.$nav.each(function () { linkHref = self.getHash($(this)); $target = $('#' + linkHref); if ($target.length) { topPos = $target.offset().top; self.sections[linkHref] = Math.round(topPos) } }) }, getSection: function (windowPos) { var returnValue = null; var windowHeight = Math.round(this.$win.height() * this.config.scrollThreshold); for (var section in this.sections) { if ((this.sections[section] - windowHeight) < windowPos) { returnValue = section } } return returnValue }, handleClick: function (e) { var self = this; var $link = $(e.currentTarget); var $parent = $link.parent(); var newLoc = '#' + self.getHash($link); if (!$parent.hasClass(self.config.currentClass)) { if (self.config.begin) { self.config.begin() } self.adjustNav(self, $parent); self.unbindInterval(); self.scrollTo(newLoc, function () { if (self.config.changeHash) { window.location.hash = newLoc } self.bindInterval(); if (self.config.end) { self.config.end() } }) } e.preventDefault() }, scrollChange: function () { var windowTop = this.$win.scrollTop(); var position = this.getSection(windowTop); var $parent; if (position !== null) { $parent = this.$elem.find('a[href$="#' + position + '"]').parent(); if (!$parent.hasClass(this.config.currentClass)) { this.adjustNav(this, $parent); if (this.config.scrollChange) { this.config.scrollChange($parent) } } } }, scrollTo: function (target, callback) { var offset = $(target).offset().top; $('html, body').animate({ scrollTop: offset }, this.config.scrollSpeed, this.config.easing, callback) }, unbindInterval: function () { clearInterval(this.t); this.$win.unbind('scroll.onePageNav') } }; OnePageNav.defaults = OnePageNav.prototype.defaults; $.fn.onePageNav = function (options) { return this.each(function () { new OnePageNav(this, options).init() }) } })(jQuery, window, document)