1.0.6 • Published 8 years ago

popgun v1.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

npm

Popgun

What is Popgun?

Popgun is a pure Javascript popover component for high performance and feature-rich web applications!

How to Use

Simple implementation

Define a target element and set some inline attributes.

html

<!-- On hover, a text popover will appear. -->
<div popgun popgun-trigger="hover" popgun-text="Hello World"></div>

Register Groups and Schemas

If there are a lot of popgun elements, rather than define inline attributes, register groups and schemas.

html

<!-- On hover, an html element popover will appear -->
<div popgun popgun-group="sampleGroup1"></div>

<!-- On click or hover, a text popover will appear. -->
<div popgun popgun-group="sampleGroup2"></div>

<!-- On click or hover, a text popover will appear with the overriden inline attribute. -->
<div popgun 
     popgun-group="sampleGroup2" 
     popgun-text="Inline attribute override group attributes, which override schema options.">
</div>

js

// A base schema 
var schema = {
  hoverDelay: 200,
  trigger: 'hover'
}
popgun.registerSchema('sampleSchema', schema);

// A group based on schema
var group = {
  schemaId: 'sampleSchema',
  options: {
    html: '<div>html element</div>'
  }
}

// Another group based on schema that overrides one of the schema attribute
var anotherGroup = {
  schemaId: 'sampleSchema',
  options: {
    text: 'This is sample text.',
    trigger: 'click hover'
  }
}

popgun.registerGroup('sampleGroup1', group);
popgun.registerGroup('sampleGroup2', anotherGroup);

Popgun Attributes

Some Popgun attributes that you can define are:

  • containerCushion: (int - default 10) the amount of padding between the popover border and the window.
  • darkStyle: (boolean - default false) Sets a dark theme to the popover.
  • disable: (boolean - default false) Clicking elsewhere on the page of a pinned popover will not hide the popm if this is set to true.
  • disableClickOff: (boolean - default false) When triggering a popgun target, the popover will not display if this attribute is set to true.
  • fadeDuration: (int - default 100) time for pop to fade in and out.
  • html: an html element for the content of the popover (will take precedence over the text attribute).
  • optimzePlacement: (boolean - default true) popgun will decide how to best position the popover.
  • placement: (string - default 'top') you can set placement of popover around target - 'top', 'bottom', 'left', 'right'.
  • reusePopover: (boolean - default true) boolean which sets whether popgun will reuse the same popover when moving between two Popgun targets of the same group.
  • showDelay: (int - default 0) the time it takes between the user triggering the target and the popover appearing.
  • text: text content for the popover.
  • timeToHoverOnPop: (int - default 300) the time a user has to hover back over the popover when they hover off the target.
  • tipClass: (string - default '') Adds css classes to the popover container (class names should be space separated).
  • trigger: (string - default 'hover') triggers for the target to show pop - 'hover', 'click', 'focus'.

DOM Events

Throughout the life cycle of the popover, Popgun will fire the following events onto the target:

Show States

  • PopgunContentSetup
  • PopgunPrePosition
  • PopgunPreShow
  • PopgunShowing

Hide States

  • PopgunPreHide
  • PopgunHidden

js

el.addEventListener('PopgunPreShow', function(e) {
  console.log('PopgunPreShow');
}, false);

Run Demo Popgun Application

Run bin/iqb install to install the npm and typings dependencies.

Run bin/iqb start to run a demo application with Popgun.

1.0.6

8 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.0.60

9 years ago

0.0.59

9 years ago

0.0.58

9 years ago

0.0.57

9 years ago

0.0.56

9 years ago

0.0.55

9 years ago

0.0.54

9 years ago

0.0.53

9 years ago

0.0.52

9 years ago

0.0.51

9 years ago

0.0.50

9 years ago

0.0.49

9 years ago

0.0.48

9 years ago

0.0.47

9 years ago

0.0.45

9 years ago

0.0.44

9 years ago

0.0.43

9 years ago

0.0.42

9 years ago

0.0.41

9 years ago

0.0.40

9 years ago

0.0.39

9 years ago

0.0.38

9 years ago

0.0.37

9 years ago

0.0.36

9 years ago

0.0.35

9 years ago

0.0.34

9 years ago

0.0.33

9 years ago

0.0.32

9 years ago

0.0.31

9 years ago

0.0.30

9 years ago

0.0.29

9 years ago

0.0.28

9 years ago

0.0.27

9 years ago

0.0.26

9 years ago

0.0.25

9 years ago

0.0.24

9 years ago

0.0.23

9 years ago

0.0.22

9 years ago

0.0.21

9 years ago

0.0.20

9 years ago

0.0.19

9 years ago

0.0.18

9 years ago

0.0.17

9 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

9 years ago

0.0.13

9 years ago

0.0.12

9 years ago

0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago

0.0.0

9 years ago