Skip to content

JavaScript API

Jory Hogeveen edited this page Jun 7, 2018 · 15 revisions

Global Object ocsOffCanvasSidebars

Properties

site_close (boolean)
This will close the sidebar when clicking on the main website (true by default)

link_close (boolean)
(since 0.5) This will close the sidebar when clicking on a link (true by default)

disable_over (numeric / pixels)
This will disable the off-canvas sidebars when the window width is above the set pixels

hide_control_classes (boolean)
This will hide the off-canvas sidebars control elements by their classes when the window width is above the value set in disable_over

scroll_lock (boolean)
This will disable scrolling in the main website when a off-canvas sidebar is active

sidebars (object of objects)
The off-canvas sidebars and their settings

slidebarsController (object)
The Slidebars instance

container (jQuery object)
The site container element (top level)

useAttributeSettings (boolean)
This will use the attributes as settings instead of this objects settings

legacy_css (boolean)
Is OCS in legacy CSS (CSS2) mode?

_toolbar (boolean)
Is the WP Admin Bar shown?

_touchmove (boolean)
Used to prevent an actual swipe event to behave like a click. (bug in some browsers)
If set to true the user is swiping

_debug (boolean)
Since: 0.4
Is debug mode enabled? (WP_DEBUG)


Methods:

setupTriggers (overwritable)
Setup all default triggers (default functionality from the plugin)

setSidebarDefaultSettings (overwritable) Set the default settings for sidebars (by default only if they are not found)

_getSetting (internal function, do not overwrite)
Get the global setting or the sidebar setting (if set to overwrite)

_checkDisableOver (internal function, do not overwrite)
Validate the disable_over setting ( using _getSetting() )


Hooks

Since: 0.4

$(window).trigger( 'ocs_before', this );
Triggers before Slidebars is loaded

$(window).trigger( 'ocs_loaded', this );
Triggers after Slidebars is loaded

$(window).trigger( 'ocs_initialized', this );
Triggers after Slidebars is initialized

$(window).trigger( 'ocs_after', this );
Triggers after full initialization

You can’t perform that action at this time.