Giter VIP home page Giter VIP logo

sliding-doors's Introduction

Sliding-Doors

A super skinny, super flexible jQuery horizontal accordian

Introduction

I created this plugin out of necessity. Every accordian plugin I tried in the past was too pushy. It had limited customization with far too much built in CSS, themes, etc. So this is a super light weight horizontal accordian. The customization is up to you. The plugin comes with zero lines of accompanying CSS for you to deal with. If you want to make it look less plain, go for it, but far be it from me to assume you want some wieird theme.

What it does

The plugin looks for an unordered list and then creates a horizontal accordian from the list items. From there it looks for some options that determine the size and display of your accordian.

The Code

You MUST declare the size of your accordian. There are 2 ways to do this. One is to declare the width of a closed panel, the width of and open panel and the height. The other way is to declare the width of and open panel, the width for the whole panel set and the height. Then let the plugin figure out the rest. Examples of both follow.

###Plugin with width of open panel, closed panels and height declared

$(document).ready(function(){
  $("#panels").slidingDoors({    
    widthClosed: 30,        
    widthOpen: 500,        
    height: 350        
  });    
});

###Plugin with open panel, total width and height declared

$(document).ready(function(){
  $("#panels").slidingDoors({
      widthOpen: 500,
      fitToWidth: 900,
      height: 350
  });
});

##Advanced Usage

The plugin provides several options that allow you to gain more control. There are also events available to you so you can pile on effects. Below is the plugin with all the non-required options. This is also the code that is running the sliding doors example provided in the index.html file included in this repository.

$(document).ready(function(){
    $("#panels").slidingDoors({
        widthOpen: 750,
        fitToWidth: 960,
        height: 350,
        firstPanel: 4,
        activationMethod: 'hover',
        easingMethod: 'swing',
        easingLength: 600,
        panelFocus: function() {
            console.log('Focused: ' + $(' img', this).prop('alt'));
        },
        panelBlur: function() {
            console.log('Blurred: ' + $(' img', this).prop('alt'));
        },
        perIterationInactive: function() {
            $(' img', this).stop().animate({ opacity: .5});
        },
        perIterationActive: function() {
            $(' img', this).stop().animate({ opacity: 1});
        },
        onLoaded: function(returnObject) {
            $(returnObject.doors).each(function(index, element){
                if(returnObject.intialSlideIndex != index){
                    $(' img', element).css('opacity', .5);
                }
            });
        }
    });
}); 

###For default values and options see the index.html file included in this repository

sliding-doors's People

Contributors

peterugh avatar

Watchers

James Cloos avatar  avatar

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.