Skip to content

Commit

Permalink
🔖 Release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nzbin committed May 20, 2018
1 parent 20ccf6e commit 097e957
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 21 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ $("[data-magnify=gallery]").magnify();
## Events

You can define callbacks in `callbacks` option. In each callback `this` is the `Magnify` instance. You can also get the element clicked of plugin's init from `arguments` of Function.
You can define callbacks in `callbacks` option. In each callback `this` is the `Magnify` instance. You can also get the element clicked of plugin's init from arguments `el` of Function.

```js
$("[data-magnify=gallery]").magnify({
Expand All @@ -231,6 +231,14 @@ $("[data-magnify=gallery]").magnify({
},
closed: function(el){
// Will fire after modal is closed
},
beforeChange: function(index){
// Will fire before image is changed
// The arguments is the index of image group
},
changed: function(index){
// Will fire after image is changed
// The arguments is the index of image group
}
}
});
Expand Down
12 changes: 8 additions & 4 deletions dist/jquery.magnify.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* | | | | _ | \_/ | |\ |_| |_| | | |
* |__| |__|__| |__|\____/|_|__| \__|_____|__| |__|
*
* jquery.magnify.js v0.8.1
* jquery.magnify.js v1.0.0
*
* A jQuery plugin to view images just like in windows
*
Expand Down Expand Up @@ -158,7 +158,7 @@ var $W = $(window),
zIndex: 1090,

// Selector of drag handler
dragHandle: '',
dragHandle: false,

// Callback events
callbacks: {
Expand Down Expand Up @@ -383,7 +383,11 @@ Magnify.prototype = {
this.$magnify.css('z-index', zIndex);

// Set handle element of draggable
this.dragHandle = this.options.dragHandle ? this.$magnify.find(this.options.dragHandle) : this.$magnify;
if (!this.options.dragHandle || this.options.dragHandle === '.magnify-modal') {
this.dragHandle = this.$magnify;
} else {
this.dragHandle = this.$magnify.find(this.options.dragHandle);
}

},
open: function () {
Expand All @@ -409,7 +413,7 @@ Magnify.prototype = {
this.build();

this._triggerHook('beforeOpen', this.$el);

// Add Magnify to DOM
$('body').append(this.$magnify);

Expand Down
3 changes: 1 addition & 2 deletions dist/jquery.magnify.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 097e957

Please sign in to comment.