1.0.35 • Published 3 years ago

jquery-slideoutpanel v1.0.35

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

jQuery SlideOutPanel

NPM_PACKAGE

Simple jQuery Plugin to add a sliding out panel.

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>

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

Options

NameTypeDefaultOptionsDescription
bodyPushbooleanfalsetrue falseEnables 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 falseEnables the esc key to close all panels
offsetTopString0Offset the top of the panel
screenCloseBooleantruetrue falseEnables closing of panels by clicking on the background screen.
screenOpacityString0.5Set the background screen's opacity
screenZindexString9998Set the background screen's z-index
showScreenBooleantruetrue falseEnable/Disable showing the background screen
slideFromStringrighttop right bottom leftSet 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
const slideOutPanel = $('#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

1.0.35

3 years ago

1.0.34

4 years ago

1.0.33

4 years ago

1.0.32

4 years ago

1.0.31

4 years ago

1.0.30

4 years ago

1.0.29

4 years ago

1.0.28

4 years ago

1.0.27

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.22

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.12

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago