Pointy

A jQuery plugin that dynamically points one element at another.

Download

Features

Notes

To Do

Basic Setup

<script src="js/jquery.min.js"></script>
<!-- using jQuery UI draggable -->
<script src="js/jquery-ui.min.js"></script>
<script src="js/jquery.pointy.js"></script>
<script>
$(function(){

  // $pointer points at $pointy
  var $pointer = $('.label.pointer'),

    // initialize pointy (showing all options; but not all defaults)
    $pointy = $('.repo-name').pointy({
      pointer      : $pointer,
      arrowWidth   : 10, // width of pointer base
      borderWidth  : 1,  // pointer stroke width
      flipAngle    : 45, // angle @ which to flip pointer to a closer side
      defaultClass : '', // additional class name added to the pointer & the arrow (canvas)
      activeClass  : 'pointy-active', // class added to base & pointer on updating

      // optional; if not set, plugin will attempt to match the base color
      borderColor     : null,
      backgroundColor : null,

      // tweaks
      useOffset : null
    });

  // Using jQuery UI draggable (any draggable code will work)
  $label.draggable({
    containment : '.top',
    drag : function() {
      $pointy.trigger('pointy-update');
    }
  });

});
</script>

Options

Methods