Skip to content

Commit

Permalink
bugfix header
Browse files Browse the repository at this point in the history
  • Loading branch information
FrDH committed Oct 25, 2014
1 parent 3d3fe88 commit 480c0fb
Show file tree
Hide file tree
Showing 15 changed files with 161 additions and 155 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jQuery.mmenu",
"main": "src/js/jquery.mmenu.min.js",
"version": "4.6.0",
"version": "4.6.1",
"homepage": "http://mmenu.frebsite.nl/",
"authors": [
"Fred Heusschen <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion mmenu.jquery.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mmenu",
"version": "4.6.0",
"version": "4.6.1",
"title": "jQuery mmenu",
"description": "The best jQuery plugin for app look-alike on- and off-canvas menus with sliding submenus for your website and webapp.",
"keywords": [
Expand Down
48 changes: 10 additions & 38 deletions src/js/addons/jquery.mmenu.header.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,64 +87,36 @@
$clse.attr( 'href', _page );
}

if ( !addon_added )
{
$prev
.add( $next )
.add( $clse )
.off( _e.click )
.on( _e.click,
function( e )
{
e.preventDefault();
e.stopPropagation();

var href = $(this).attr( 'href' );
if ( href !== '#' )
{
if ( _page && href == _page )
{
that.$menu.trigger( _e.close );
}
else
{
$(href, that.$menu).trigger( _e.open );
}
}
}
);
}

$panels
.each(
function()
{
var $panl = $(this);

// Find title, prev and next
var $ttl = $('.' + that.conf.classNames[ _ADDON_ ].panelHeader, $panl),
$prv = $('.' + that.conf.classNames[ _ADDON_ ].panelPrev, $panl),
$nxt = $('.' + that.conf.classNames[ _ADDON_ ].panelNext, $panl),
var $ttl = $panl.find('.' + that.conf.classNames[ _ADDON_ ].panelHeader),
$prv = $panl.find('.' + that.conf.classNames[ _ADDON_ ].panelPrev),
$nxt = $panl.find('.' + that.conf.classNames[ _ADDON_ ].panelNext);

_ttl = $ttl.html(),
var _ttl = $ttl.html(),
_prv = $prv.attr( 'href' ),
_nxt = $nxt.attr( 'href' );

var _prv_txt = $prv.html(),
_nxt_txt = $nxt.html();

if ( !_ttl )
{
_ttl = $('.' + _c.subclose, $panl).html();
_ttl = $panl.find('.' + _c.subclose).html();
}
if ( !_ttl )
{
_ttl = opts.title;
}
if ( !_prv )
{
_prv = $('.' + _c.subclose, $panl).attr( 'href' );
_prv = $panl.find('.' + _c.subclose).attr( 'href' );
}

var _prv_txt = $prv.html(),
_nxt_txt = $nxt.html();

// Update header info
var updateHeader = function()
Expand Down Expand Up @@ -211,7 +183,7 @@
{
o = {};
}
if ( !( o.add instanceof Array ) )
if ( o.add && !( o.add instanceof Array ) )
{
o.add = [ 'prev', 'title', 'next' ];
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/addons/jquery.mmenu.header.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 40 additions & 35 deletions src/js/addons/jquery.mmenu.offcanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@

this[ _ADDON_ + '_initPage' ]( glbl.$page );
this[ _ADDON_ + '_initBlocker' ]();
this[ _ADDON_ + '_initOpenClose' ]();
this[ _ADDON_ + '_bindCustomEvents' ]();

this[ _ADDON_ + '_initAnchors' ]();
this[ _ADDON_ + '_initEvents' ]();
this.$menu[ conf.menuInjectMethod + 'To' ]( conf.menuWrapperSelector );
};

Expand Down Expand Up @@ -108,6 +107,8 @@

$[ _PLUGIN_ ].prototype._openSetup = function()
{
var that = this;

// Close other menus
glbl.$allMenus.not( this.$menu ).trigger( _e.close );

Expand Down Expand Up @@ -143,7 +144,10 @@
glbl.$html.addClass( clsn.join( ' ' ) );

// Open
this.vars.opened = true;
setTimeout(function(){
that.vars.opened = true;
},this.conf.openingInterval);

this.$menu.addClass( _c.current + ' ' + _c.opened );
};

Expand Down Expand Up @@ -256,52 +260,53 @@
glbl.$page = $page;
};

$[ _PLUGIN_ ].prototype[ _ADDON_ + '_initOpenClose' ] = function()
$[ _PLUGIN_ ].prototype[ _ADDON_ + '_initAnchors' ] = function()
{
var that = this;

// Open menu
var id = this.$menu.attr( 'id' );
if ( id && id.length )
{
if ( this.conf.clone )
{
id = _c.umm( id );
}
glbl.$body
.on( _e.click,
'a',
function( e )
{
var $t = $(this);

$('a[href="#' + id + '"]')
.off( _e.click )
.on( _e.click,
function( e )
// Open menu
var id = that.$menu.attr( 'id' );
if ( id && id.length )
{
e.preventDefault();
that.open();
if ( that.conf.clone )
{
id = _c.umm( id );
}
if ( $t.is( '[href="#' + id + '"]' ) )
{
e.preventDefault();
that.open();
}
}
);
}

// Close menu
var id = glbl.$page.attr( 'id' );
if ( id && id.length )
{
$('a[href="#' + id + '"]')
.on( _e.click,
function( e )

// Close menu
var id = glbl.$page.attr( 'id' );
if ( id && id.length )
{
e.preventDefault();
that.close();
if ( $t.is( '[href="#' + id + '"]' ) )
{
e.preventDefault();
that.close();
}
}
);
}
}
);

};

$[ _PLUGIN_ ].prototype[ _ADDON_ + '_bindCustomEvents' ] = function()
$[ _PLUGIN_ ].prototype[ _ADDON_ + '_initEvents' ] = function()
{
var that = this,
evnt = _e.open + ' ' + _e.opening + ' ' + _e.opened + ' ' + _e.close + ' ' + _e.closing + ' ' + _e.closed + ' ' + _e.setPage;

this.$menu
.off( evnt )
.on( evnt,
function( e )
{
Expand Down
2 changes: 1 addition & 1 deletion src/js/addons/jquery.mmenu.offcanvas.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 480c0fb

Please sign in to comment.