-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d6464a2
Showing
26 changed files
with
14,717 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
MIT License | ||
|
||
Copyright (c) 2020 | ||
NAM LE | ||
leqnam@live.com/ nam@nready.net | ||
https://nready.net | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
# ezoom.js | ||
|
||
![ezoom.js](https://img.shields.io/static/v1?label=ezoom.js&message=v0.1.0&color=yellow) ![GitHub](https://img.shields.io/github/license/leqnam/ezoom) | ||
|
||
ezoom.js is a jQuery plugin for simple Image with zoom effect. | ||
|
||
This plugin in under development to support Next/Prev a gallery Images/SVG later. | ||
|
||
You can find the demo here: [https://leqnam.github.io/ezoom](https://leqnam.github.io/ezoom) | ||
|
||
## Table of contents | ||
- [Installation](#Installation) | ||
- [Usage](#Usage) | ||
- [Options](#Options) | ||
- [Usages](#Usages) | ||
- [Methods](#Methods) | ||
- [Events](#Events) | ||
- [Versions](#Versions) | ||
- [Acknowledgements](#Acknowledgements) | ||
- [License](#License) | ||
|
||
|
||
<hr> | ||
|
||
|
||
## Installation | ||
|
||
Set up the HTML: | ||
```html | ||
<div id="imgDiv"> | ||
<img src="images/may.png"> | ||
</div> | ||
``` | ||
and the javascript: | ||
|
||
```javascript | ||
ezoom.onInit($('#imgDiv img'), { | ||
onClose: function (result) { | ||
alert(result); | ||
} | ||
}); | ||
``` | ||
|
||
<hr> | ||
|
||
## Usage | ||
|
||
The plugin can be use with method `onInit` as two ways: | ||
- Expand an image HTML dom in a Zoom Modal to zoom in/out and rotate image. The element dom is passed on the query selector. | ||
|
||
```javascript | ||
ezoom.onInit(domElement, { | ||
onClose: function (result) { | ||
alert(result); | ||
} | ||
}); | ||
``` | ||
|
||
- Expand an remote image with an URL in a Zoom Modal to zoom in/out adn rotate image, by passing the `src` option. | ||
|
||
```javascript | ||
const src = 'some image url'; | ||
ezoom.onInit(domElement, { | ||
src: src, | ||
onClose: function (result) { | ||
alert(result); | ||
} | ||
}); | ||
``` | ||
|
||
<hr> | ||
|
||
## Options | ||
|
||
At the initialize, only `src` and `hideControlBtn` is available. | ||
|
||
Option | Value | Description | ||
---|---|--- | ||
`domElement` | dom | HTML DOM querySelector | ||
`src` | string | An Image remote URL | ||
`hideControlBtn` | boolean | Hide the Rotate Left/Right | ||
|
||
<br> | ||
Ex: To hide the Rotate Left/Right: | ||
|
||
```javascript | ||
ezoom.onInit($('#imgDiv img'), { | ||
hideControlBtn: true | ||
}); | ||
``` | ||
|
||
<hr> | ||
|
||
## Methods | ||
|
||
At the initialize, we only need the `onInit` to create the zoom-modal instance and listen on this instance. | ||
|
||
<hr> | ||
|
||
## Events | ||
|
||
Event | Description | ||
---|--- | ||
`onShow` | Fired when the Zoom modal is shown | ||
`onClose` | Fired when the Zoom modal is closed | ||
`onRotate` | Fired when rotating the image | ||
`onMoveStarted` | Fired when starting to move the image | ||
`onMovedCompleted` | Fired when finished moving by release the mouse | ||
`onMoving` | Fired while moving the image | ||
|
||
<br> | ||
The events can be used look like: | ||
|
||
```javascript | ||
ezoom.onInit(domElement, { | ||
onRotate: function(callback) { | ||
// some magic | ||
} | ||
}); | ||
``` | ||
|
||
<hr> | ||
|
||
## Versions | ||
|
||
* v0.1.0 | ||
1. Single image | ||
2. Add event listeners and callback | ||
|
||
|
||
<br> | ||
<hr> | ||
|
||
## Acknowledgements | ||
|
||
This plugin has been developed to use in my internal project to replace panzoom (https://github.com/anvaka/panzoom) - that has some issues with rotate. | ||
|
||
An blog has been released: | ||
- in Vietnamese: https://nready.net/ezoom | ||
|
||
<br> | ||
<hr> | ||
|
||
## License | ||
|
||
Licensed under the MIT license. | ||
|
||
Nam Le, 2021, | ||
leqnam@live.com, | ||
|
||
http://nready.net |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Font Awesome Free License | ||
------------------------- | ||
|
||
Font Awesome Free is free, open source, and GPL friendly. You can use it for | ||
commercial projects, open source projects, or really almost whatever you want. | ||
Full Font Awesome Free license: https://fontawesome.com/license/free. | ||
|
||
# Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/) | ||
In the Font Awesome Free download, the CC BY 4.0 license applies to all icons | ||
packaged as SVG and JS file types. | ||
|
||
# Fonts: SIL OFL 1.1 License (https://scripts.sil.org/OFL) | ||
In the Font Awesome Free download, the SIL OFL license applies to all icons | ||
packaged as web and desktop font files. | ||
|
||
# Code: MIT License (https://opensource.org/licenses/MIT) | ||
In the Font Awesome Free download, the MIT license applies to all non-font and | ||
non-icon files. | ||
|
||
# Attribution | ||
Attribution is required by MIT, SIL OFL, and CC BY licenses. Downloaded Font | ||
Awesome Free files already contain embedded comments with sufficient | ||
attribution, so you shouldn't need to do anything additional when using these | ||
files normally. | ||
|
||
We've kept attribution comments terse, so we ask that you do not actively work | ||
to remove them from files, especially code. They're a great way for folks to | ||
learn about Font Awesome. | ||
|
||
# Brand Icons | ||
All brand icons are trademarks of their respective owners. The use of these | ||
trademarks does not indicate endorsement of the trademark holder by Font | ||
Awesome, nor vice versa. **Please do not use brand logos for any purpose except | ||
to represent the company, product, or service to which they refer.** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
console.log(`Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com | ||
License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) | ||
`) |
Oops, something went wrong.