GithubHelp home page GithubHelp logo

ruisoftware / jquery-rsrefpointer Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 381 KB

Displays arrows linking related elements in the page

JavaScript 97.39% HTML 0.77% CSS 1.84%
arrow javascript jquery codepen position relationship editor design

jquery-rsrefpointer's Introduction

jquery-rsRefPointer Build Status

Eases web navigation, through the use of visual relationships (arrows) between page elements.

Can be usefull to help the user cross-reference content that might not be noticeable at first sight.

rsrefpointerdemo Demo available at src/demo/dragonfly.html

Key Features

  • Arrows makes a visual connection from a start element to an end element, even when the position/size of these elements change;
  • Non intrusive. The arrows are hidden by default and only appear when the mouse overs the start element (or when the start element receives focus for mobile devices). Alternatively they can be always visible;
  • Shapes available: Line, Polyline, Quadratic Bezier curves and Cubic Bezier curves;
  • Powerfull design-time mode that provides a Photoshop alike GUI. The tool generates JS code with all the parameters filled for you;
  • Small footprint, excluding the design-time mode file, that should never be used in production anyway.

Installation

You can install from npm:

npm install jquery.rsRefPointer --save

or directly from git:

<script src="http://rawgit.com/ruisoftware/jquery-rsRefPointer/master/src/jquery.rsRefPointer.js"></script>

or you can download the Zip archive from github, clone or fork this repository and include jquery.rsRefPointer.js from your local machine.

You also need to download jQuery. In the example below, jQuery is downloaded from Google cdn.

Usage

<!doctype html>
<html>
<head>
  <title>jquery-rsRefPointer plug-in</title>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
  <script src="http://rawgit.com/ruisoftware/jquery-rsRefPointer/master/src/jquery.rsRefPointer.js"></script>
  <script>
    $(document).ready(function () {
      $('.source').rsRefPointer();
    });
  </script>
  
  <style>
    .source {
      background-color: cyan;
    }
  </style>
</head>
<body>
  Mouse over
  <span class="source">here</span>
  to see two arrows pointing to
  <span class="target">[this target]</span>
  and this image
  <img width="400" height="200" class="target" src="http://lorempixel.com/400/200/sports">
    
  <p>Shrink your browser width to cause a line break on the image.<br>Watch how the arrow follows the target new location.</p>
<body>
</html>

You can check it out here on CodePen.
In this example, you can see two arrows, one for each .target element. Because there is one .source element, only one instance of the plug-in is binded to the .source element.
If there was three .source elements and two .target elements, then three instances of the plug-in would be created (one for each .source) and each instance would show 2 arrows. You can test this, by adding more .source elements in the CodePen link.

Design-time mode

This mode is nothing more than a tool to help you configure the arrows the way you wish.
The workflow is:

  1. Enter Design-time mode
  2. Edit your arrows
  3. Generate code and copy it
  4. Paste the new code into your page
  5. Exit Design-time mode

Enter Design-time mode

Add the jquery.rsRefPointer-design.js script after the jquery.rsRefPointer.js script:

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
  <script src="http://rawgit.com/ruisoftware/jquery-rsrefPointer/master/src/jquery.rsRefPointer.js"></script>
  <script src="http://rawgit.com/ruisoftware/jquery-rsrefPointer/master/src/jquery.rsRefPointer-design.js"></script>

Save your html and refresh your page.
Now, you have entered Design-time mode. Sample on CodePen.

Edit your arrows

You can add new arrows, add middle points to the selected arrow, delete arrows or points and drag points to new positions.
You might change several arrow style properties, as well.
screen shot 2016-04-05 at 01 00 20

Generate code and copy it

When you are done, click on "Generate Code", click on "Select all" and copy it. screen shot 2016-04-05 at 01 03 47

Paste the new code into your page

Back to your editor, replace your old code
screen shot 2016-04-05 at 01 31 43
with the new one
screen shot 2016-04-05 at 01 05 57

Exit Design-time mode

Remove the jquery.rsRefPointer-design.js script.

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
  <script src="http://rawgit.com/ruisoftware/jquery-rsrefPointer/master/src/jquery.rsRefPointer.js"></script>

Refresh your page. Design-time is gone and now you have your fancy arrows running.
Check it out here

As you can see, design-time is a temporary tool that should be used to fecth the correct parameters.
It is not intended to be deployed into production.

License

This project is licensed under the terms of the MIT license

Bug Reports & Feature Requests

Please use the issue tracker to report any bugs or file feature requests.

Contributing

Please refer to the Contribution page from more information.

jquery-rsrefpointer's People

Contributors

ruisoftware avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

yashilanka

jquery-rsrefpointer'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.