Giter Site home page Giter Site logo

scrolltab's Introduction

Scrolltab is a jQuery plugin that adds tabs visually associated to their position relative to the scroll bar.

This enables a developer to attach floating tabs to the scrollbar of the brwoser that will scroll the user to the position indicated by the tab. This tab is expandable with content within.

Demo

http://chris-saylor.com/Scrolltab/example.html

Install

There are two ways of installing:

  1. Bower - bower install jquery-scrolltab

  2. Download - You can install traditionally by downloading the minified version.

Options

  • title: HTML to display within the pin
  • classname: The classname for the pin to use
  • mouseenter: function to execute when the mouseenter event fires on this pin
  • mouseleave: function to execute when the mouseleave event fires on this pin
  • click: function to execute when the click event fire on this pin

Setting Options via data attributes

You can set the title and classname of the pin via data attributes on the object.

<h4 class="scrolltab" data-st-title="Pin Title" data-st-classname="custom-pin-class">Title</h4>

Behaviors

The behavior of how the pin displays and hides is customizable by overriding the behavior functions.

Initial Display

When a new pin is created by the .scrolltab() call.

  • Default behavior: fadeIn('slow')
$.fn.scrolltab.pinInitialDisplay

Display On Update

If the element the scrollpin was tracking becomes visible again, this will redisplay the pin.

  • Default behavior: fadeIn('slow')
$.fn.scrolltab.pinDisplay

Pin Hide

If the element the scrollpin was tracking is hidden from the dom, this will hide the pin.

  • Default behavior: fadeOut('fast')
$.fn.scrolltab.pinHide

Examples

	// Enables a pin with the default classname
	$('<dom object>').scrolltab();
	// Changes the classname of the created (or existing) pin
	$('<dom object>').scrolltab({ classname: 'test' });
	// Modifies the behavior of the click event on the pin
	$('<dom object').scrolltab({
		click: function (e) {
			e.preventDefault();
			alert('Pin clicked.')
		}
	});
	// Modify the initial behavior of pins showing on page load
	$.fn.scrolltab.pinInitialDisplay = function(pin) {
		// I don't want the fancy fadein affect.
		pin.show();
	};
	$('<dom object>').scrolltab();
	// Modify the default attributes of all pins created now on
	// In this example, I want all pins to have a click event function
	// callback attached.
	$.fn.scrolltab.default = $.extend($.fn.scrolltab.default, {
		click: function (e) {
			e.preventDefault();
			alert('Pin clicked!');
		}
	});
	$('<dom object>').scrolltab();

Build

Scrolltab uses Grunt CLI via NodeJS for linting and building the minified production file.

Setup

Install grunt cli globally:

$ npm install -g grunt-cli

Install dev dependencies:

$ npm install -d

Execute lint and build:

$ grunt

License

This software is protected under the MIT license.

scrolltab's People

Contributors

cjsaylor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scrolltab's Issues

Dom size trigger update bug

Changing document height is not correctly refreshing and updating the pin positions (or whether they should continue to exist).

Need to revisit objects that are pinned existence checks.

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.