Giter Club home page Giter Club logo

jquery.pinon's Introduction

jQuery pinOn()

Position a child relative to its parent. Could be very useful for tooltips for example.

Demo

You can try the plugin on the demo page.

Usage

$("#child").pinOn( parent [, position] [, align] );

@param parent

It's the parent relative to wich the #child will be positionned.

Type : STRINGor jQuery Object.

@param position

The position describe where the child must be positionned relatively to its parent.

Type : STRING

You can use words top,bottom,left AND right with an optionnal signed shift value (i.e. top-25 right+45). The position must be indicate with one or two words : one horizontal AND / OR one vertical. The order of words doesn't matter.

+-------------+----------+--------------+
|   top left  |    top   |  top right   |
+-------------+----------+--------------+
|    left     |  PARENT  |    right     |
+-------------+----------+--------------+
| bottom left |  bottom  | bottom right |
+-------------+----------+--------------+

You can try the demo.

@param align

The align define how the child must be align relatively to its parent if you sepcified only one dimmension in position.

Type : STRING
Optionnal : default value = center;

You can use an alignement among : center, top,bottom,left OR right with an optionnal signed shift value (i.e. right-25).

By default, if you specified only one position, the child will be centered in the other dimmention. But you can specify the alignement that you want.

No align

$("#child").pinOn( "#parent" , "top+20" );

Result

           +-----------+
           |   #child  |
           +-----------+

+---------------------------------+
|             #parent             |
+---------------------------------+

with align

$("#child").pinOn( "#parent" , "top+20" , "right" );

Result

                      +-----------+
                      |   #child  |
                      +-----------+

+---------------------------------+
|             #parent             |
+---------------------------------+

You can try the demo.

jquery.pinon's People

Contributors

renaudtertrais avatar

Stargazers

Valentine avatar

Watchers

James Cloos avatar Valentine avatar

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.