Skip to content

Commit 3e64669

Browse files
authored
Merge pull request #15 from daisuke-yoshimoto/fix-issue-14
Fix to not call mediumZoom if the page does not move.
2 parents aaa9539 + 00041e9 commit 3e64669

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/zoom.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@ export default (function () {
3333

3434

3535
return {
36-
onRouteUpdate({ location }) {
37-
36+
onRouteUpdate({ location , previousLocation}) {
3837
if( location && location.hash && location.hash.length ) {
3938
return;
4039
}
4140

41+
if (!previousLocation || location.pathname === previousLocation.pathname) {
42+
return;
43+
}
44+
4245
setTimeout(() => {
4346
mediumZoom(selector, options);
4447
}, 1000);

0 commit comments

Comments
 (0)