Git Product home page Git Product logo

sliding-panel's Introduction

#Some context

Sliding Panel is a lightweight, unobtrusive, yet extremely useful and effective jQuery plugin.

Its goal is to provide a simple way to turn any DOM element into a retractable, sliding panel. It was created to fulfill the need of showing examples on unoome (in french only for the moment), a service aimed at small/medium enterprises/associations with no IT skill to easily create websites. So a really easy and intuitive help was needed, and that's how Sliding Panel was born.

Hopefully, it was designed with extensibility in mind, so you can use it not only to display help or examples, but also to display anything you want : an options panel for example. Just call :

$(your_DOM_element).slidingPanel();

And you're ready to go. The flexibility given by the settings should allow you to tune the plugin the way you like. Of course, it comes with a default CSS, but you can customize it to make it fit your needs.

#Usage

##JS

Just call:

$('#example').slidingPanel(options);

##HTML

Just any valid HTML element:

<div id="example">A nice looking example...</div>

##CSS

A CSS file is included in the downloadable package. But you might want to add some custom CSS to make the integration more seamless. The CSS looks like this:

.slidingpanel_tab {
    background-color: #eee  ;
    color: #aaa  ;
    text-align: center;
    font-size: 18px;
    line-height: 22px;
    cursor: pointer;
    padding: 2px;
}

You can edit it the way you want, all the important CSS is set by the plugin itself, so there is no risk that you break something. However, to facilitate the updates, I would highly recommend you to leave this file untouched and create another one which contain all your custom CSS rules, possibly overriding the default ones.

##Options

There are a few options to make Sliding Panel more flexible. Here they are, with their default values:

  • position: ['top', 'right', 'bottom', 'left']
    • Defines where to put the sliding panel on the webpage.
  • offset: {}
    • Allows to finely tune position, relatively to top, right, bottom or left side of the positioned container, or combination of two (top and right for example: {top: '150px', right: '-10px'})
  • speed: 250
    • Sets the speed of the sliding effect on opening and closing
  • timeout: 500
    • Will wait "timeout" ms before closing the panel after the mouse has left the panel
  • event: ['hover', 'click']
    • Allows to control the panel either by hover or by click
  • hideTriggerClass: 'slidingpanel_hide_trigger'
    • A class to define which element(s) will close the panel (useful only with openByDefault: true)
  • wrapperClass: 'slidingpanel_wrapper'
    • The CSS class applied to the sliding panel wrapper
  • slidingElementClass: 'slidingpanel_element'
    • The CSS class applied to the sliding panel
  • tabClass: 'slidingpanel_tab'
    • The CSS class applied to the tab allowing mouseover
  • wrapperTemplate: '<div></div>'
    • The template used as a wrapper
  • tabTemplate: '<div></div>'
    • The template used as a tab
  • tabText: 'E<br/>X<br/>A<br/>M<br/>P<br/>L<br/>E'
    • The tab text
  • openByDefault: [true, false]
    • Defines whether the panel should be open by default or closed

sliding-panel's People

Contributors

pjparra avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

prashanthkavya

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.