Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.6.0 #25

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
.DS_Store
/node_modules/
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Version 1.6.0 (November 28, 2016) ###
* Added ability to add custom classes
* Ability to set options per element via "data-minitip-<option>" attribute

### Version 1.5.3 (July 15, 2012) ###
* Added 'stemOff' option to correct stem positioning when a large browser-radius is used (cross browser solution, thanks Jason Day).
* Correctly unbind HTML click event on miniTip hide.
Expand Down
49 changes: 32 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
jQuery miniTip Plugin (v1.5.3)
jQuery miniTip Plugin (v1.6.0)
---------------------

License
Expand Down Expand Up @@ -32,6 +32,12 @@ Description
* Tested in: IE7+, Firefox 3.5+, Safari 3+, Chrome, Opera 10+
* More features can be found at the [miniTip](http://goldfirestudios.com/blog/81/miniTip-jQuery-Plugin) home page

### Installation ###

You can either download it from the `dist` directory, or install it via NPM

npm i --save minitip

### Documentation ###

Please go to the [miniTip](http://goldfirestudios.com/blog/81/miniTip-jQuery-Plugin) home page to view the full documentation (it is really straightforward, I promise!).
Expand All @@ -40,25 +46,34 @@ Examples
========
This is the most basic usage. It displays a miniTip on mouseover of the element with ID "tip" and content of the title tag (maximum width of 250px). Mouseout of the "tip" hides the miniTip.

$('#tip').miniTip();
$('#tip').miniTip();

This is a more advanced example utilizing all available options (as of v1.0). The element with ID of "tip" will be activated by click instead of mouseover. It will have a title bar with text "Title Bar" and content defined in the JS call. It will wait .5s before showing and hiding the tooltip, and the fade animation will be .5s both ways. The default anchor position is east (the right side of the anchor element). Auto-hide is set to false, so the tooltip will only hide once your mouse is off of the tooltip and the anchor element. The max width is set to 50px and the offset is 15px, so the tooltip's stem will be 15px from the edge of the anchor element. Finally, an event will fire when the tooltip is shown (alerting "Hello,"), and another will be fired when it is hidden (alerting "World!").

$('#tip').miniTip({
title: 'Title Bar',
content: 'This is a test miniTip!',
delay: 500,
anchor: 'e',
event: 'click',
fadeIn: 500,
fadeOut: 500,
aHide: false,
maxW: '50px',
offset: 15,
stemOff: 0,
show: function(){ alert('Hello,'); },
hide: funciton(){ alert('World!'); }
});
$('#tip').miniTip({
title: 'Title Bar',
content: 'This is a test miniTip!',
delay: 500,
anchor: 'e',
event: 'click',
fadeIn: 500,
fadeOut: 500,
aHide: false,
maxW: '50px',
offset: 15,
stemOff: 0,
show: function(){ alert('Hello,'); },
hide: funciton(){ alert('World!'); },
class: "custom-class"
});

You can also pass options per element using the element's attributes:

```html

<div data-minitip-class='my-custom-class' data-minitip-maxW='500'>hover me</div>

```

More examples and live demos can be found at [http://goldfirestudios.com/blog/81/miniTip-jQuery-Plugin](http://goldfirestudios.com/blog/81/miniTip-jQuery-Plugin)

Expand Down
18 changes: 18 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const fs = require('fs');
const uglifyjs = require('uglifyjs');
const cleanCss = require('clean-css');

const jsSource = fs.readFileSync("./src/jquery.miniTip.js","utf8");
const cssSource = fs.readFileSync("./src/miniTip.css","utf8");

// JavaScript
// original
fs.writeFileSync("./dist/jquery.minitip.js",jsSource);
// minified
fs.writeFileSync("./dist/jquery.minitip.min.js",uglifyjs.minify(jsSource,{fromString:true}).code);

// CSS
// original
fs.writeFileSync("./dist/minitip.css",cssSource);
// minified
fs.writeFileSync("./dist/minitip.min.css",new cleanCss().minify(cssSource).styles);
Loading