Fixed nav control.

This commit is contained in:
Keyser H
2019-06-20 20:19:58 -07:00
committed by Denise Schannon
parent 2d283771ff
commit 37af9dcd7a
+24 -18
View File
@@ -166,44 +166,50 @@
$.extend(Plugin.prototype, { $.extend(Plugin.prototype, {
init: function () { init: function () {
this.openSubmenu();
this.submenuIndicators(); this.submenuIndicators();
this.openSubmenu();
if(this.settings.clickEffect){ if(this.settings.clickEffect){
this.addClickEffect(); this.addClickEffect();
} }
}, },
openSubmenu: function () { openSubmenu: function () {
var opts = this.settings; //to differ from local variable "this" var touchmoved;
$(this.element).children("ul").find("li").bind("click touchstart", function(e){ opts = this.settings; //to differ from local variable "this"
e.stopPropagation();
$(this.element).children("ul").find("li").find('.submenu-indicator').bind("click", function(e){
var targetElement = $(this).parent().parent()
e.preventDefault(); e.preventDefault();
if ($(this).attr('class') === 'back-to-the-top') { if (targetElement.attr('class') === 'back-to-the-top') {
$('.side-menus-container').scrollTop(0); $('.side-menus-container').scrollTop(0);
} }
if($(this).children(".submenu").length > 0) { if(targetElement.children(".submenu").length > 0) {
if($(this).children(".submenu").css("display") == "none") { if(targetElement.children(".submenu").css("display") == "none") {
$(this).children(".submenu").delay(opts.showDelay).slideDown(opts.speed); targetElement.children(".submenu").delay(opts.showDelay).slideDown(opts.speed);
$(this).children(".submenu").siblings("a").addClass("submenu-indicator-minus"); targetElement.children(".submenu").siblings("a").addClass("submenu-indicator-minus");
$(this).addClass("activate"); targetElement.addClass("activate");
if(opts.singleOpen){ if(opts.singleOpen){
$(this).siblings().children(".submenu").slideUp(opts.speed); targetElement.siblings().children(".submenu").slideUp(opts.speed);
$(this).siblings().children(".submenu").siblings("a").removeClass("submenu-indicator-minus"); targetElement.siblings().children(".submenu").siblings("a").removeClass("submenu-indicator-minus");
$(this).removeClass("activate"); targetElement.removeClass("activate");
} }
return false; return false;
} else { } else {
$(this).children(".submenu").delay(opts.hideDelay).slideUp(opts.speed); targetElement.children(".submenu").delay(opts.hideDelay).slideUp(opts.speed);
$(this).removeClass("activate"); targetElement.removeClass("activate");
} }
if($(this).children(".submenu").siblings("a").hasClass("submenu-indicator-minus")){ if(targetElement.children(".submenu").siblings("a").hasClass("submenu-indicator-minus")){
$(this).children(".submenu").siblings("a").removeClass("submenu-indicator-minus"); targetElement.children(".submenu").siblings("a").removeClass("submenu-indicator-minus");
} }
} }
window.location.href = $(this).children("a").attr("href");
}); });
// .on('touchmove', function(e) {
// touchmoved = true;
// }).on('touchstart', function(e) {
// touchmoved = false;
// });
}, },
submenuIndicators: function () { submenuIndicators: function () {