Giter Site home page Giter Site logo

migzhuo / horizontalscroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from drrasic/horizontalscroller

0.0 1.0 0.0 231 KB

Javascript plugin that scrolls lists horizontaly and works when list is floated right

JavaScript 64.21% HTML 18.98% CSS 16.81%

horizontalscroller's Introduction

HorizontalScroller

HorizontalScroller - A quickly built plugin that scrolls lists horizontaly with left/right advancer buttons, could not get any light plugin to work when the list is aligned on the right side of the screen so i made this, needs more work probably.

  • plane Javascript, no dependencies
  • Easy to use

Usage

Include HorizontalScroller

<script src="hScroller.js"></script>

Setup HTML with classes

    <div id="List1" class="hs-Wrapper">
        <nav class="hs-ListWrap">
            <ul class="hs-List">
                <li class="hs-Item"><a href="#">List item</a></li>
                <li class="hs-Item"><a href="#">List item</a></li>
                <li class="hs-Item"><a href="#">List item</a></li>
                <li class="hs-Item"><a href="#">List item</a></li>
            </ul>
        </nav>
        <button class="hs-Advancer hs-Advancer_Left" type="button">
            <svg class="hs-Advancer_Icon" viewbox="0 0 100 100"><path class="arrow" d="M 50,0 L 60,10 L 20,50 L 60,90 L 50,100 L 0,50 Z" /></svg>
        </button>
        <button class="hs-Advancer hs-Advancer_Right" type="button">
            <svg class="hs-Advancer_Icon" viewbox="0 0 100 100"><path class="arrow" d="M 50,0 L 60,10 L 20,50 L 60,90 L 50,100 L 0,50 Z" transform="translate(85,100) rotate(180)" /></svg>
        </button>
    </div>

HorizontalScroller() constructor accepts two arguments: the container element ID and an optional SETTINGS object.

    (function() {
      
        var hScroller = new HorizontalScroller('List1');
        
        window.onresize = function(event) {
            hScroller.showHideAdvancers();
        };
        
    })();
  SETTINGS
  
  ** @listTravelDistance        distance to travel on advancer click (default:150px)
  ** @paddingWithoutAdvancers   set padding without advancers
  ** @paddingWithAdvancers      set padding with advancers

horizontalscroller's People

Contributors

drrasic avatar

Watchers

 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.