Skip to content
This repository was archived by the owner on Apr 16, 2023. It is now read-only.

Repository files navigation

jQuery SlideOutPanel

NPM_PACKAGE

Simple jQuery Plugin to add a sliding out panel.

Status

I have decided to archive this project as I am no longer maintaining it.

Installation

npm install --save-dev jquery-slideoutpanel

Demo

https://webdevnerdstuff.github.io/jquery-SlideOutPanel/demo.html


Usage

HTML

The html must be set up with the proper id and internal elements.

Allowed tags: <header><section><footer>

Optional tags: <header><footer>

Required tag: <section>

<divid="slide-out-panel" class="slide-out-panel"><header>Panel Title</header><section>Panel content section</section><footer>Panel footer</footer></div>

Options


NameTypeDefaultOptionsDescription
bodyPushbooleanfalsetrue
false
Enables pushing the body when the tab opens (works with slideFrom right and left
breakpointString768pxSets the breakpoint (matches the breakpoint in SCSS/CSS). This is used when bodyPush is true
closeBtnhtml&#10005;
Add a custom close button instead of the default
closeBtnSizeString12pxAdjust the close button size
enableEscapeKeyBooleanfalsetrue
false
Enables the esc key to close all panels
offsetTopString0Offset the top of the panel
screenCloseBooleantruetrue
false
Enables closing of panels by clicking on the background screen.
screenOpacityString0.5Set the background screen's opacity
screenZindexString9998Set the background screen's z-index
showScreenBooleantruetrue
false
Enable/Disable showing the background screen
slideFromStringrighttop
right
bottom
left
Set to choose where the panel should slide out from
transitionStringeaseSet the transition-timing-function. Accepts the standard values used with CSS.
transitionDurationString0.35sSet the duration of the transitions. Adding "s" is optional.
widthString350pxSet the panels width

$('#slide-out-panel').SlideOutPanel({bodyPush: false,closeBtn: '<i class="fas fa-times"></i>',closeBtnSize: '',enableEscapeKey: true,offsetTop: '50px',screenClose: false,screenOpacity: '1',screenZindex: '9998',showScreen: false,slideFrom: 'right',transition: 'ease',transitionDuration: '0.35s',width: '350px',});

Events


NameDescription
renderedFired after the panel is finished building
beforeOpenFired before panel opens
afterOpenFired after panel has opened
beforeClosedFired before panel is closed
afterClosedFired after the panel is closed

$('#slide-out-panel').SlideOutPanel({rendered(){// Some code...},beforeOpen(){// Some code...},afterOpen(){// Some code...},beforeClosed(){// Some code...},afterClosed(){// Some code...},});

Methods


NameDescription
openOpens the panel
closeCloses the panel
toggleToggles the panel open/close
destroyRemoves the panel from the DOM

constslideOutPanel=$('#slide-out-panel').SlideOutPanel();slideOutPanel.open();slideOutPanel.close();slideOutPanel.toggle();slideOutPanel.destroy();

Sass Variables


VariableDefaultDescription
$pieces-padding15pxPadding for the panel pieces (header, section, footer)
$so-screen-sm768pxResponsive breakpoint
$so-close-btn-color#000Color of the close button
$so-close-font-size12pxFont size of the close button
$so-container-background#fffThe panel background color
$so-container-box-shadow-3px 3px 9px rgba(0, 0, 0, .3)The panel box shadow
$so-container-transitiontop ease, right ease, bottom ease, left easeTransition effect
$so-container-z-index9999The panel z-index
$so-content-no-header-padding-top$pieces-padding * 2The top padding of the <section> when there is no header
$so-header-background-color#fffThe header background color
$so-header-border-color#e5e5e5The header bottom border color
$so-header-border-width1pxThe header border width
$so-content-background-color#fffThe <section> background color
$so-footer-background-color#fffThe <footer> background color

Examples

Initialize plugin:

$('#slide-out-panel').SlideOutPanel();

Changing the direction the panel slides out from:

$('#slide-out-panel').SlideOutPanel({slideFrom: 'top',});$('#slide-out-panel').SlideOutPanel({slideFrom: 'right',});$('#slide-out-panel').SlideOutPanel({slideFrom: 'bottom',});$('#slide-out-panel').SlideOutPanel({slideFrom: 'left',});

Close button customization:

$('#slide-out-panel').SlideOutPanel({closeBtn: '<i class="fas fa-times"></i>',closeBtnSize: '18px',});

Background screen customization:

$('#slide-out-panel').SlideOutPanel({screenClose: true,screenOpacity: '0.5',screenZindex: '9998',showScreen: true,});

Dependencies

jQuery


Change Log

CHANGELOG


License

Copyright (c) 2020 WebDevNerdStuff Licensed under the MIT license.

@WebDevNerdStuff

About

Simple jQuery Plugin to add a sliding out panel.

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages