Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the way public methods are exposed #52

Open
digggggggggg opened this issue Feb 11, 2016 · 0 comments
Open

Change the way public methods are exposed #52

digggggggggg opened this issue Feb 11, 2016 · 0 comments

Comments

@digggggggggg
Copy link

var panel = $('selector').scotchPanel({ ... });
...
panel.open();

....isn't the jQuery way :-)

How about this?

$('selector').scotchPanel({ ... });
...
$('selector').scotchPanel('open');

....then we can always call the public methods without having to store the panel object at the time of creation.

And this way the object is still chainable, the jquery way :-)

$('selector').scotchPanel({ ... });
...
$('selector').addClass('something').data('whatever',true).scotchPanel('open');
...
$('selector').removeClass('something').data('whatever',false).scotchPanel('close');

You could also expand the number of public methods available like..

$('selector').scotchPanel({ ... });
$('selector').scotchPanel('open');
$('selector').scotchPanel('switch', 'right'); // change panel layout?
$('selector').scotchPanel('trigger', '.selector'); // add a new trigger
$('selector').scotchPanel('do_something', 'var 1', 'var 2'); // something entirely different?

ps.:
Of course we could still store $('selector') in a variable so we don't call it over and over again, but you get the point, I hope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant