Drag.Percent 0.1

This class allows for elements to be dragged using percent-based units. The units are calculated based on the element/container ratio.



Details

Author
EmEhRKay
Current version
0.1
GitHub
emehrkay/DragPercent
Downloads
2273
Category
Interface
Tags
Report
GitHub Issues

Releases


Dependencies

  • _self_/_current_:
    • Core/Element.Dimensions
    • /Drag

How to use

Usage is the same as Drag except with an additional argument in the constructor defining the element's container.

Options:

  • auto_resize -- Flag stating that the window resize event should trigger the Drag.Percent.defineScale method. Defaults to true

Events:

  • See Mootools.more.Drag

Usage:

var element = document.id('element'),  
    container = document.id('container'),  
    options = {'auto_resize': false},  
    drag = new Drag.Percent(element, container, options); 

If your element or container will resize, simply call the defineScale method after the resizing.

element.setStyle('width', '50%');
drag.defineScale();

Discuss

A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.

Found a bug in this plugin? Please report it this repository's Github Issues.

blog comments powered by Disqus