bigSlide.js icon indicating copy to clipboard operation
bigSlide.js copied to clipboard

Make menu open by default?

Open rabbitfighter opened this issue 10 years ago • 7 comments

Hello. bigSlide is a great plugin! Thanks! I just have one question: is there any way to have the menu open on page load? I would like to have it default to open on certain pages of my site.

Best, Brad

rabbitfighter avatar Jun 19 '14 23:06 rabbitfighter

im also looking to do this

jacksonhoose avatar Aug 05 '14 15:08 jacksonhoose

Same as the others above, I'm looking to have the menu open by default, as well as create a cookie to remember the user's choice of open or closed.

alishabussart avatar Aug 09 '14 08:08 alishabussart

I am also interested in this functionality. I would like to be able to have the active li be open when the page loads.

bmartinstudio avatar Oct 10 '14 16:10 bmartinstudio

I forgot about this for a while but just came back to it and realized it's easy enough to just initialize the script for manual access to the functions (see the readme) and then call the bigSlide.open() function right after you initialize on any pages where you want it open by default.

rabbitfighter avatar Oct 17 '14 20:10 rabbitfighter

@rabbitfighter nailed it. Thanks!

I've been meaning to make this an option when initializing the plugin to simplify things further.

ascott1 avatar Oct 18 '14 11:10 ascott1

Okay, so this took an hour or two to figure out, but I was able to add this to the functionality and it was actually really easy. Maybe ascott1 will implement this into his plugin - which is an amazing plugin, btw.

Open the uncompressed version of the plugin. Find this line:

var settings = $.extend({

Add this line under it:

 'openDefault': false,

Find this line:

this.width = settings.menuWidth;

Add these lines under it:

if (settings.openDefault) {
    $(document).ready(function() {
        view.toggleOpen();
    });
}

Save the file. Now you can use "openDefault" as an option - it's set to false by default.

$('.menu-link').bigSlide({
    openDefault: true
});

I know this was an old topic, but I hope it helps someone as it's functionality that I needed.

awl19 avatar Aug 04 '15 11:08 awl19

Could this approach be modified to open the menu at a screen width (want it open at desktop by default closed for mobile)?

eric432 avatar Mar 22 '16 21:03 eric432