Skip to content

Change the way public methods are exposed #52

@digggggggggg

Description

@digggggggggg
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions