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

fix(slideOnTouch): slideOnTouch not changes images on mobile devices #572

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": ["javascript"]
}
1 change: 0 additions & 1 deletion docs/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
}

.docs-pictures > li > img {
cursor: -webkit-zoom-in;
cursor: zoom-in;
width: 100%;
}
Expand Down
2 changes: 1 addition & 1 deletion lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
'*.js': 'eslint --fix',
'*.{css,scss}': 'stylelint --fix',
'*.{css,scss}': 'stylelint --fix --allow-empty-input',
};
52 changes: 26 additions & 26 deletions src/css/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
.viewer-fullscreen-exit,
.viewer-close {
&::before {
background-image: url('../images/icons.png');
background-image: url("../images/icons.png");
background-repeat: no-repeat;
background-size: 280px;
color: transparent;
Expand All @@ -27,72 +27,72 @@

.viewer-zoom-in::before {
background-position: 0 0;
content: 'Zoom In';
content: "Zoom In";
}

.viewer-zoom-out::before {
background-position: -20px 0;
content: 'Zoom Out';
content: "Zoom Out";
}

.viewer-one-to-one::before {
background-position: -40px 0;
content: 'One to One';
content: "One to One";
}

.viewer-reset::before {
background-position: -60px 0;
content: 'Reset';
content: "Reset";
}

.viewer-prev::before {
background-position: -80px 0;
content: 'Previous';
content: "Previous";
}

.viewer-play::before {
background-position: -100px 0;
content: 'Play';
content: "Play";
}

.viewer-next::before {
background-position: -120px 0;
content: 'Next';
content: "Next";
}

.viewer-rotate-left::before {
background-position: -140px 0;
content: 'Rotate Left';
content: "Rotate Left";
}

.viewer-rotate-right::before {
background-position: -160px 0;
content: 'Rotate Right';
content: "Rotate Right";
}

.viewer-flip-horizontal::before {
background-position: -180px 0;
content: 'Flip Horizontal';
content: "Flip Horizontal";
}

.viewer-flip-vertical::before {
background-position: -200px 0;
content: 'Flip Vertical';
content: "Flip Vertical";
}

.viewer-fullscreen::before {
background-position: -220px 0;
content: 'Enter Full Screen';
content: "Enter Full Screen";
}

.viewer-fullscreen-exit::before {
background-position: -240px 0;
content: 'Exit Full Screen';
content: "Exit Full Screen";
}

.viewer-close::before {
background-position: -260px 0;
content: 'Close';
content: "Close";
}

.viewer-container {
Expand Down Expand Up @@ -156,7 +156,7 @@
}

.viewer-navbar {
background-color: rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 50%);
overflow: hidden;
}

Expand Down Expand Up @@ -238,7 +238,7 @@
padding: 6px 3px;

& > li {
background-color: rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 50%);
border-radius: 50%;
cursor: pointer;
float: left;
Expand All @@ -249,7 +249,7 @@

&:focus,
&:hover {
background-color: rgba(0, 0, 0, 0.8);
background-color: rgba(0, 0, 0, 80%);
}

&:focus {
Expand Down Expand Up @@ -293,7 +293,7 @@
}

.viewer-tooltip {
background-color: rgba(0, 0, 0, 0.8);
background-color: rgba(0, 0, 0, 80%);
border-radius: 10px;
color: #fff;
display: none;
Expand Down Expand Up @@ -329,7 +329,8 @@
}

.viewer-button {
background-color: rgba(0, 0, 0, 0.5);
-webkit-app-region: no-drag;
background-color: rgba(0, 0, 0, 50%);
border-radius: 50%;
cursor: pointer;
height: 80px;
Expand All @@ -339,11 +340,10 @@
top: -40px;
transition: background-color 0.15s;
width: 80px;
-webkit-app-region: no-drag;

&:focus,
&:hover {
background-color: rgba(0, 0, 0, 0.8);
background-color: rgba(0, 0, 0, 80%);
}

&:focus {
Expand Down Expand Up @@ -375,7 +375,7 @@
}

.viewer-backdrop {
background-color: rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 50%);
}

.viewer-invisible {
Expand Down Expand Up @@ -412,10 +412,10 @@
.viewer-loading {
&::after {
animation: viewer-spinner 1s linear infinite;
border: 4px solid rgba(255, 255, 255, 0.1);
border-left-color: rgba(255, 255, 255, 0.5);
border: 4px solid rgba(255, 255, 255, 10%);
border-left-color: rgba(255, 255, 255, 50%);
border-radius: 50%;
content: '';
content: "";
display: inline-block;
height: 40px;
left: 50%;
Expand Down
52 changes: 26 additions & 26 deletions src/css/viewer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
&-fullscreen-exit,
&-close {
&::before {
background-image: url('../images/icons.png');
background-image: url("../images/icons.png");
background-repeat: no-repeat;
background-size: 280px;
color: transparent;
Expand All @@ -28,72 +28,72 @@

&-zoom-in::before {
background-position: 0 0;
content: 'Zoom In';
content: "Zoom In";
}

&-zoom-out::before {
background-position: -20px 0;
content: 'Zoom Out';
content: "Zoom Out";
}

&-one-to-one::before {
background-position: -40px 0;
content: 'One to One';
content: "One to One";
}

&-reset::before {
background-position: -60px 0;
content: 'Reset';
content: "Reset";
}

&-prev::before {
background-position: -80px 0;
content: 'Previous';
content: "Previous";
}

&-play::before {
background-position: -100px 0;
content: 'Play';
content: "Play";
}

&-next::before {
background-position: -120px 0;
content: 'Next';
content: "Next";
}

&-rotate-left::before {
background-position: -140px 0;
content: 'Rotate Left';
content: "Rotate Left";
}

&-rotate-right::before {
background-position: -160px 0;
content: 'Rotate Right';
content: "Rotate Right";
}

&-flip-horizontal::before {
background-position: -180px 0;
content: 'Flip Horizontal';
content: "Flip Horizontal";
}

&-flip-vertical::before {
background-position: -200px 0;
content: 'Flip Vertical';
content: "Flip Vertical";
}

&-fullscreen::before {
background-position: -220px 0;
content: 'Enter Full Screen';
content: "Enter Full Screen";
}

&-fullscreen-exit::before {
background-position: -240px 0;
content: 'Exit Full Screen';
content: "Exit Full Screen";
}

&-close::before {
background-position: -260px 0;
content: 'Close';
content: "Close";
}

&-container {
Expand Down Expand Up @@ -157,7 +157,7 @@
}

&-navbar {
background-color: rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 50%);
overflow: hidden;
}

Expand Down Expand Up @@ -241,7 +241,7 @@
padding: 6px 3px;

& > li {
background-color: rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 50%);
border-radius: 50%;
cursor: pointer;
float: left;
Expand All @@ -252,7 +252,7 @@

&:focus,
&:hover {
background-color: rgba(0, 0, 0, 0.8);
background-color: rgba(0, 0, 0, 80%);
}

&:focus {
Expand Down Expand Up @@ -296,7 +296,7 @@
}

&-tooltip {
background-color: rgba(0, 0, 0, 0.8);
background-color: rgba(0, 0, 0, 80%);
border-radius: 10px;
color: #fff;
display: none;
Expand Down Expand Up @@ -332,7 +332,8 @@
}

&-button {
background-color: rgba(0, 0, 0, 0.5);
-webkit-app-region: no-drag;
background-color: rgba(0, 0, 0, 50%);
border-radius: 50%;
cursor: pointer;
height: 80px;
Expand All @@ -342,11 +343,10 @@
top: -40px;
transition: background-color 0.15s;
width: 80px;
-webkit-app-region: no-drag;

&:focus,
&:hover {
background-color: rgba(0, 0, 0, 0.8);
background-color: rgba(0, 0, 0, 80%);
}

&:focus {
Expand Down Expand Up @@ -378,7 +378,7 @@
}

&-backdrop {
background-color: rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 50%);
}

&-invisible {
Expand Down Expand Up @@ -415,10 +415,10 @@
&-loading {
&::after {
animation: viewer-spinner 1s linear infinite;
border: 4px solid rgba(255, 255, 255, 0.1);
border-left-color: rgba(255, 255, 255, 0.5);
border: 4px solid rgba(255, 255, 255, 10%);
border-left-color: rgba(255, 255, 255, 50%);
border-radius: 50%;
content: '';
content: "";
display: inline-block;
height: 40px;
left: 50%;
Expand Down
11 changes: 10 additions & 1 deletion src/js/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,16 @@ export default {
* @type {string | Function}
*/
url: 'src',

/**
* Restricts the movement of the image off the screen of the device.
* @type {boolean}
*/
moveLimit: false,
/**
* Toggle the image size between its natural size and initial size.
* @type {boolean}
*/
toggleSizeToInitial: false,
/**
* Event shortcuts.
* @type {Function}
Expand Down
Loading