Giter Site home page Giter Site logo

jquery.porthole's Introduction

jquery.porthole

Simply and fast viewport plugin for jQuery which using css transforms.

If you have large size content that should be placed into the small viewport, this plugin is for you.

Explanatory demo

http://dmitryfillo.github.io/jquery.porthole/

Installation

The best way:

bower install jquery.porthole

How to use

You should include the plugin to the page, something like this:

If you are using js builders, e.g. gulp, grunt, some framework assets system, etc, you should have no problems with this plugin. Also it supports AMD/RequireJS, CommonJS, ES6 modules (and, of course, globals).

API

Porthole object has options property which is an object with:

  • startPos
  • onDrag
  • onDragStop
  • onDragStart

These properties can be assign via constructor or directly to the options object.

Also porthole object has methods:

  • init
  • destroy
  • update
  • getCurrentPos
  • getStatus

porthole.options.startPos

Start position coordinates.

Default is [0, 0].

porthole.options.onDrag

This method will be fired when dragging (mousemove/touchmove) event occurs.

porthole.options.onDragStart

This method will be fired when drag start (mousedown/touchstart) event occurs.

porthole.options.onDragStop

This method will be fired when drag stop (mouseup/touchend) event occurs.

porthole.destroy

Destroy method. You can use it for destroy the porthole and render back to the initial state.

porthole.init

Initialization method. Automatically fires in the constructor. You can use it for manual init after destroy.

porthole.update

Update method. Useful for update the porthole after options change. Simply fires destroy() first and init() after.

porthole.getCurrentPos

Gets current porthole position. Actually it is css transform coordinates.

Example:

porthole.getStatus

Gets current porthole status. Returns object with status properties. There are:

  • initialized (it's false after destroy(), otherwise it's true)

Example:

jquery.porthole's People

Contributors

dmitryfillo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jquery.porthole's Issues

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.