Commit 34f7c522 by 王东红

优化导航条细节

parent 6df625e5
......@@ -55,6 +55,17 @@ define([
this.delay = this.options.delay;
var len = $(".navigation ul li.level-top").length;
console.log(len)
var hide = 4;
$(".navigation ul li.level-top").each(function(index) {
if (index > hide) {
$(this).hide();//第(hide+1)几个以后开始隐藏
}
});
this._super();
$(window).on('resize', function () {
self.element.find('.submenu-reverse').removeClass('submenu-reverse');
......@@ -94,6 +105,7 @@ define([
_assignControls: function () {
this.controls = {
toggleBtn: $('[data-action="toggle-nav"]'),
toggleNext: $('.naxt-but'),
swipeArea: $('.nav-sections')
};
......@@ -105,14 +117,32 @@ define([
*/
_listen: function () {
var controls = this.controls,
toggle = this.toggle;
toggle = this.toggle,
toggleNext = this.toggleNext;
controls.toggleBtn.off('click');
controls.toggleBtn.on('click', toggle.bind(this));
controls.toggleNext.off('click');
controls.toggleNext.on('click', toggleNext.bind(this));
controls.swipeArea.off('swipeleft');
controls.swipeArea.on('swipeleft', toggle.bind(this));
},
toggleNext: function(){
var hide = 4;
var i = 2;
var start_l = (i-1) * hide;
var end_l = start_l + hide;
console.log(start_l)
console.log(end_l)
$(".navigation ul li.level-top").each(function(index) {
if (index >= start_l && index <= end_l) {
$(this).show();//第(hide+1)几个以后开始隐藏
} else {
$(this).hide();
}
});
},
/**
* Toggle.
*/
......@@ -503,6 +533,8 @@ define([
_toggleDesktopMode: function () {
var categoryParent, html;
$(this.element).off('click mousedown mouseenter mouseleave');
this._on({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment