1.0.6 • Published 7 years ago

popgun v1.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
7 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

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.60

8 years ago

0.0.59

8 years ago

0.0.58

8 years ago

0.0.57

8 years ago

0.0.56

8 years ago

0.0.55

8 years ago

0.0.54

8 years ago

0.0.53

8 years ago

0.0.52

8 years ago

0.0.51

8 years ago

0.0.50

8 years ago

0.0.49

8 years ago

0.0.48

8 years ago

0.0.47

8 years ago

0.0.45

8 years ago

0.0.44

8 years ago

0.0.43

8 years ago

0.0.42

8 years ago

0.0.41

8 years ago

0.0.40

8 years ago

0.0.39

8 years ago

0.0.38

8 years ago

0.0.37

8 years ago

0.0.36

8 years ago

0.0.35

8 years ago

0.0.34

8 years ago

0.0.33

8 years ago

0.0.32

8 years ago

0.0.31

8 years ago

0.0.30

8 years ago

0.0.29

8 years ago

0.0.28

8 years ago

0.0.27

8 years ago

0.0.26

8 years ago

0.0.25

8 years ago

0.0.24

8 years ago

0.0.23

8 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago

0.0.0

8 years ago