Giter Club home page Giter Club logo

minimap's Introduction

minimap - A jQuery Plugin

A preview of full webpage or its DOM element with flexible positioning and navigation support #####Demo Page ![Gitter](https://badges.gitter.im/Join Chat.svg)

Getting Started

Download the latest code

Fork this repository or download js/css files from dist directory.

Including it on your page

Include jQuery and this plugin on a page.

<link rel="stylesheet" href="minimap.min.css" />
<script src="jquery.js"></script>
<script src="minimap.min.js"></script>

Basic Usage

//Desired dom element
var previewBody = $('body').minimap();

Properties

heightRatio

height ratio of the view port. ratio can be in the range [0.0, 1.0). (default: 0.6)

widthRatio

width ratio of the view port. ratio can be in the range [0.0, 0.5). (default: 0.05)

offsetHeightRatio

Margin top ratio of the view port. ratio can be in the range (0.0, 0.9]. (default: 0.035)

offsetWidthRatio

Margin left or right(based on position property) ratio of the view port. ratio can be in the range (0.0, 0.9]. (default: 0.035)

position

position of the minimap. Supported positions are:

  1. 'right' (default)
  2. 'left'

touch

touch support. (default: true)

smoothScroll

linear animation support for scrolling. (dafault: true)

smoothScrollDelay

Smooth scroll delay in milliseconds. (default: 200ms)

disableFind

disableFind if true, prevents browser CTRL+F from finding duplicated text in minimap. (default: false)

Setters

function setPosition(position)

Set position property. position can be either 'left' or 'right'

function setHeightRatio(ratio)

Set heightRatio property.

function setWidthRatio(ratio)

Set widthRatio property.

function setOffsetHeightRatio(ratio)

Set offsetHeightRatio property.

function setOffsetWidthRatio(ratio)

Set offsetWidthRatio property.

function setSmoothScroll(smooth)

Set smoothScroll property

function setSmoothScrollDelay(duration)

Set setSmoothScrollDelay property.

Callback

function onPreviewChange(minimap, scale)

onPreviewChange callback will be triggered for the below cases:

  1. View port is resized.
  2. Calling setter functions.

Use this function to customize DOMs inside minimap.

Parameters:

minimap - $minimap DOM
scale - Scale object with `x` and `y` properties.(width/height ratio of minimap with respect to viewport)

Other functions

function show()

Show preview

function hide()

Hide preview

function toggle()

Toggle Preview

Default Settings

Mini-map with default values

var previewBody = $('body').minimap(
    heightRatio : 0.6,
    widthRatio : 0.05,
    offsetHeightRatio : 0.035,
    offsetWidthRatio : 0.035,
    position : "right",
    touch: true,
    smoothScroll: true,
    smoothScrollDelay: 200,
    onPreviewChange: function(minimap, scale) {},
    disableFind : false
});

CSS classes

Use the below css classes for customization

.minimap - Mini-map area

.miniregion - Mini-map view area

Caveats

  1. Async updates to the dom elements after minimap was created may not reflect in the preview.

License

This plugin is licensed under the MIT license.

Copyright (c) 2014 Prince John Wesley

minimap's People

Contributors

fia5h avatar jmheretik avatar princejwesley 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minimap's Issues

jQuery free version

I'd like to use this on a project but pulling in jQuery is unfortunately out of the question, I was wondering if you would be okay with me converting this to a pure JavaScript version, removing jQuery as a dependency.

Minimap does not scroll all the way to the top

On the demo, once the minimap has been engaged it will not scroll all the way to the top (in webkit / Opera). The issue seems to be that the top of the viewport is always where the mouse pointer is, but at the start the viewport is above the minimap.

The mouseover event of the minimap obviously doesn't extend past itself, so the viewport can never get back up to the top unless the page scrollbar is used.

I've put a border around the minimap to illustrate.

Starting position:
2015-07-16 20_02_20-minimap - a jquery plugin _ js _ toolitup com - opera

Scrolled to the "top" after activation
2015-07-16 19_59_26-minimap - a jquery plugin _ js _ toolitup com - opera

Bug with fixed elements

White and light-gray elements are fixed elements with full width/height. They obviously don't look that nice on the minimap.
temp-git

Bug on short sites

If used on a short website (in fact the shorter the weirder behavior), the miniregion height as well as the width/height ratio on the minimap seems to bug... Alot.

This is the 'wrong' behavior:
temp-git
This is seems to be better:
temp-git-right

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.