I am using the bigSlide.js (http://ascott1.github.io/bigSlide.js/) plugin to create a slide-in menu.
I'm able to enter my own value for the width of the menu, which I've set to 250px, this is then used later in the code. The site is responsive so what I would like to happen is for the value to change depending on the window width, ie. window width 600px or less - the menu width be 100px, and if the window width is larger than 600px - the menu width be 250px.
Is this possible to do? If so, would someone be kind enough to show me how, thanks.
jQuery(function($) {
'use strict';
$.fn.bigSlide = function(options) {
var settings = $.extend({
'menu': ('#menu'),
'push': ('.push'),
'side': 'right',
'menuWidth': '250px',
'speed': '300'
}, options);
var menuLink = this,
menu = $(settings.menu),
push = $(settings.push),
width = settings.menuWidth;
var positionOffScreen = {
'position': 'fixed',
'top': '0',
'bottom': '0',
'settings.side': '-' + settings.menuWidth,
'width': settings.menuWidth,
'height': '100%'
};
var animateSlide = {
'-webkit-transition': 'all' + ' ' + settings.speed + 'ms ease',
'-moz-transition': 'all' + ' ' + settings.speed + 'ms ease',
'-ms-transition': 'all' + ' ' + settings.speed + 'ms ease',
'-o-transition': 'all' + ' ' + settings.speed + 'ms ease',
'transition': 'all' + ' ' + settings.speed + 'ms ease'
};
menu.css(positionOffScreen);
push.css(settings.side, '0');
menu.css(animateSlide);
push.css(animateSlide);
menu._state = 'closed';
menu.open = function() {
menu._state = 'open';
menu.css(settings.side, '0');
push.css(settings.side, width);
};
menu.close = function() {
menu._state = 'closed';
menu.css(settings.side, '-' + width);
push.css(settings.side, '0');
};
menuLink.on('click.bigSlide', function(e) {
e.preventDefault();
if (menu._state === 'closed') {
menu.open();
} else {
menu.close();
}
});
return menu;
};
}(jQuery));