/*!
* jquery meanmenu v2.0.8
* @copyright (c) 2012-2014 chris wharton @ meanthemes (https://github.com/meanthemes/meanmenu)
*
*/
/*
* this program is free software: you can redistribute it and/or modify
* it under the terms of the gnu general public license as published by
* the free software foundation, either version 3 of the license, or
* (at your option) any later version.
*
* this software and documentation is provided "as is," and copyright
* holders make no representations or warranties, express or implied,
* including but not limited to, warranties of merchantability or
* fitness for any particular purpose or that the use of the software
* or documentation will not infringe any third party patents,
* copyrights, trademarks or other rights.copyright holders will not
* be liable for any direct, indirect, special or consequential
* damages arising out of any use of the software or documentation.
*
* you should have received a copy of the gnu general public license
* along with this program. if not, see .
*
* find more information at http://www.meanthemes.com/plugins/meanmenu/
*
*/
(function ($) {
"use strict";
$.fn.meanmenu = function (options) {
var defaults = {
meanmenutarget: jquery(this), // target the current html markup you wish to replace
meanmenucontainer: '.mobile-menu-area .container', // choose where meanmenu will be placed within the html
meanmenuclose: "x", // single character you want to represent the close menu button
meanmenuclosesize: "18px", // set font size of close button
meanmenuopen: "", // text/markup you want when menu is closed
meanrevealposition: "right", // left right or center positions
meanrevealpositiondistance: "0", // tweak the position of the menu
meanrevealcolour: "", // override css colours for the reveal background
meanscreenwidth: "991", // set the screen width you want meanmenu to kick in at
meannavpush: "", // set a height here in px, em or % if you want to budge your layout now the navigation is missing.
meanshowchildren: true, // true to show children in the menu, false to hide them
meanexpandablechildren: true, // true to allow expand/collapse children
meanexpand: "+", // single character you want to represent the expand for uls
meancontract: "-", // single character you want to represent the contract for uls
meanremoveattrs: false, // true to remove classes and ids, false to keep them
onepage: false, // set to true for one page sites
meandisplay: "block", // override display method for table cell based layouts e.g. table-cell
removeelements: "" // set to hide page elements
};
options = $.extend(defaults, options);
// get browser width
var currentwidth = window.innerwidth || document.documentelement.clientwidth;
return this.each(function () {
var meanmenu = options.meanmenutarget;
var meancontainer = options.meanmenucontainer;
var meanmenuclose = options.meanmenuclose;
var meanmenuclosesize = options.meanmenuclosesize;
var meanmenuopen = options.meanmenuopen;
var meanrevealposition = options.meanrevealposition;
var meanrevealpositiondistance = options.meanrevealpositiondistance;
var meanrevealcolour = options.meanrevealcolour;
var meanscreenwidth = options.meanscreenwidth;
var meannavpush = options.meannavpush;
var meanrevealclass = ".meanmenu-reveal";
var meanshowchildren = options.meanshowchildren;
var meanexpandablechildren = options.meanexpandablechildren;
var meanexpand = options.meanexpand;
var meancontract = options.meancontract;
var meanremoveattrs = options.meanremoveattrs;
var onepage = options.onepage;
var meandisplay = options.meandisplay;
var removeelements = options.removeelements;
//detect known mobile/tablet usage
var ismobile = false;
if ( (navigator.useragent.match(/iphone/i)) || (navigator.useragent.match(/ipod/i)) || (navigator.useragent.match(/ipad/i)) || (navigator.useragent.match(/android/i)) || (navigator.useragent.match(/blackberry/i)) || (navigator.useragent.match(/windows phone/i)) ) {
ismobile = true;
}
if ( (navigator.useragent.match(/msie 8/i)) || (navigator.useragent.match(/msie 7/i)) ) {
// add scrollbar for ie7 & 8 to stop breaking resize function on small content sites
jquery('html').css("overflow-y" , "scroll");
}
var meanrevealpos = "";
var meancentered = function() {
if (meanrevealposition === "center") {
var newwidth = window.innerwidth || document.documentelement.clientwidth;
var meancenter = ( (newwidth/2)-22 )+"px";
meanrevealpos = "left:" + meancenter + ";right:auto;";
if (!ismobile) {
jquery('.meanmenu-reveal').css("left",meancenter);
} else {
jquery('.meanmenu-reveal').animate({
left: meancenter
});
}
}
};
var menuon = false;
var meanmenuexist = false;
if (meanrevealposition === "right") {
meanrevealpos = "right:" + meanrevealpositiondistance + ";left:auto;";
}
if (meanrevealposition === "left") {
meanrevealpos = "left:" + meanrevealpositiondistance + ";right:auto;";
}
// run center function
meancentered();
// set all styles for mean-reveal
var $navreveal = "";
var meaninner = function() {
// get last class name
if (jquery($navreveal).is(".meanmenu-reveal.meanclose")) {
$navreveal.html(meanmenuclose);
} else {
$navreveal.html(meanmenuopen);
}
};
// re-instate original nav (and call this on window.width functions)
var meanoriginal = function() {
jquery('.mean-bar,.mean-push').remove();
jquery(meancontainer).removeclass("mean-container");
jquery(meanmenu).css('display', meandisplay);
menuon = false;
meanmenuexist = false;
jquery(removeelements).removeclass('mean-remove');
};
// navigation reveal
var showmeanmenu = function() {
var meanstyles = "background:"+meanrevealcolour+";color:"+meanrevealcolour+";"+meanrevealpos;
if (currentwidth <= meanscreenwidth) {
jquery(removeelements).addclass('mean-remove');
meanmenuexist = true;
// add class to body so we don't need to worry about media queries here, all css is wrapped in '.mean-container'
jquery(meancontainer).addclass("mean-container");
jquery('.mean-container').prepend('