Git Product home page Git Product logo

transition-panel's Introduction

Transition Panel Plugin

This JavaScript plugin is used to help transition different panel contents to a main view by either through a button (nav) click or through JavaScript code.

You can go through the example folder for a working demonstration of the plugin in various scenarios.

#Current Version v1.0.5

Dependencies

  • jQuery

Bower

npm install bower -g
bower install https://github.com/brandonsherette/transition-panel.git

Nav Example

Html

<div class="container">
  <h1>Specialties</h1>
  <div class="transition-panel">
    <nav class="panel-nav">
      <button class="btn btn-primary panel-button" data-panel-target="pizza">Pizza</button>
      <button class="btn btn-primary panel-button" data-panel-target="sandwiches">Sandwiches</button>
    </nav>

    <div class="panel-view"></div>

    <div class="panel-templates">
      <div class="panel-template" id="pizza">
        <h1>Pizza</h1>
        <p>Our pizza is freshly prepared and cooked in our hand built brick fire oven!
      </div>

      <div class="panel-template" id="sandwiches">
        <h1>Sandwiches</h1>
        <p>
          Our sandwiches are made to order and only use the finest ingredients.
        </p>
      </div>
    </div>
  </div>
</div>

JavaScript Code

$(document).ready(function() {
  TransitionPanelPlugin.init().start();
});

Descriptions

TransitionPanelPlugin.init() will go through your html code and setup the plugin.

start() will load and display the first template.

Styles

The Transition Panel Plugin includes a css file that you should add which will disable the viewing of the templates in your html.

<link rel="stylesheet" href="bower_components/transition-panel/dist/styles/default.css">

Transition With Code

JavaScript

$(document).ready(function(){
  TransitionPanelPlugin.init().start();

  var curPanelIndex = 0,
  numOfPanelTemplates = TransitionPanelPlugin.getPanelTemplates().length;

  window.setInterval(function(){
    var panelContent;
          
    curPanelIndex += 1;

    // reset the index back to 0 if past the last panel
    if(curPanelIndex >= numOfPanelTemplates){
      curPanelIndex = 0;
    }

    panelContent = TransitionPanelPlugin.getPanelTemplate(curPanelIndex);

    if(panelContent){
      TransitionPanelPlugin.transitionPanel(panelContent);
    }
  }, 5000);
});

transition-panel's People

Contributors

brandonsherette 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.