Skip to content
This repository was archived by the owner on Aug 1, 2020. It is now read-only.

Commit 7332c63

Browse files
author
Fengyuan Chen
committed
Released v0.2.0
1 parent 944d280 commit 7332c63

10 files changed

+186
-119
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Changelog
22

33

4+
## 0.2.0 (Oct 18, 2015)
5+
6+
- Added one new method: "moveTo"
7+
- Improved the image loading and showing.
8+
9+
410
## 0.1.1 (Oct 7, 2015)
511

612
- Fixed the issue of modal closing after zoomed in and zoomed out.

README.md

+21-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# [Image Viewer](https://github.com/fengyuanchen/viewer)
1+
# [Viewer](https://github.com/fengyuanchen/viewer)
22

33
> A simple jQuery image viewing plugin.
44
5-
- [Demo](http://fengyuanchen.github.io/viewer)
5+
- [Demo](https://fengyuanchen.github.io/viewer)
66

77

88

@@ -64,7 +64,6 @@ Initialize with `$.fn.viewer` method.
6464

6565
```html
6666
<!-- a block container is required -->
67-
6867
<div>
6968
<img class="image" src="picture.jpg" alt="Picture">
7069
</div>
@@ -389,15 +388,14 @@ View the next image.
389388
390389
- **offsetX**:
391390
- Type: `Number`
392-
- Default: `0`
393391
- Moving size (px) in the horizontal direction
394392
395393
- **offsetY** (optional):
396394
- Type: `Number`
397395
- Moving size (px) in the vertical direction.
398396
- If not present, its default value is `offsetX`
399397
400-
Move the image.
398+
Move the image with relative offsets.
401399
402400
```js
403401
$().viewer('move', 1);
@@ -408,6 +406,20 @@ $().viewer('move', 0, 1); // Move down
408406
```
409407
410408
409+
### moveTo(x[, y])
410+
411+
- **x**:
412+
- Type: `Number`
413+
- The `left` value of the image
414+
415+
- **y** (optional):
416+
- Type: `Number`
417+
- The `top` value of the image
418+
- If not present, its default value is `x`.
419+
420+
Move the image to an absolute point.
421+
422+
411423
### zoom(ratio[, hasTooltip])
412424
413425
- **ratio**:
@@ -420,7 +432,7 @@ $().viewer('move', 0, 1); // Move down
420432
- Default: `false`
421433
- Show tooltip
422434
423-
Zoom the image.
435+
Zoom the image with a relative ratio
424436
425437
```js
426438
$().viewer('zoom', 0.1);
@@ -439,7 +451,7 @@ $().viewer('zoom', -0.1);
439451
- Default: `false`
440452
- Show tooltip
441453
442-
Zoom the image to a special ratio.
454+
Zoom the image to an absolute ratio.
443455
444456
```js
445457
$().viewer('zoomTo', 0); // Zoom to zero size (0%)
@@ -454,7 +466,7 @@ $().viewer('zoomTo', 1); // Zoom to natural size (100%)
454466
- Rotate right: requires a positive number (degree > 0)
455467
- Rotate left: requires a negative number (degree < 0)
456468
457-
Rotate the image.
469+
Rotate the image with a relative degree.
458470
459471
> Requires [CSS3 2D Transforms](http://caniuse.com/transforms2d) support (IE 9+).
460472
@@ -469,7 +481,7 @@ $().viewer('rotate', -90);
469481
- **degree**:
470482
- Type: `Number`
471483
472-
Rotate the image to a special angle.
484+
Rotate the image to an absolute degree.
473485
474486
> Requires [CSS3 2D Transforms](http://caniuse.com/transforms2d) support (IE 9+).
475487

demo/js/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ $(function () {
4747

4848
options[name] = name === 'inline' ? $input.data('value') : $input.prop('checked');
4949
$images.viewer('destroy').viewer(options);
50-
toggleButtons(name);
50+
toggleButtons(options.inline ? 'inline' : 'modal');
5151
});
5252

5353
$buttons.on('click', 'button', function () {

dist/viewer.css

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*!
2-
* Viewer v0.1.1
2+
* Viewer v0.2.0
33
* https://github.com/fengyuanchen/viewer
44
*
55
* Copyright (c) 2015 Fengyuan Chen
66
* Released under the MIT license
77
*
8-
* Date: 2015-10-07T06:34:31.370Z
8+
* Date: 2015-10-18T11:12:55.720Z
99
*/
1010
.viewer-zoom-in:before,
1111
.viewer-zoom-out:before,
@@ -136,7 +136,7 @@
136136
width: 100%;
137137
min-width: 0 !important;
138138
max-width: none !important;
139-
height: 100%;
139+
height: auto;
140140
min-height: 0 !important;
141141
max-height: none !important;
142142
}
@@ -149,6 +149,12 @@
149149
left: 0;
150150
overflow: hidden;
151151
}
152+
.viewer-canvas > img {
153+
width: auto;
154+
max-width: 90% !important;
155+
height: auto;
156+
margin: 15px auto;
157+
}
152158

153159
.viewer-footer {
154160
position: absolute;

0 commit comments

Comments
 (0)