No longer hides if mouse leaves before timeout ends.
This commit is contained in:
@@ -35,8 +35,11 @@ export default {
|
|||||||
this.show = true;
|
this.show = true;
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
console.log("Your toast time is up 👋");
|
console.log("Your toast time is up 👋");
|
||||||
if (this.mouseover !== true) {
|
|
||||||
|
if (this.mouseover === false) {
|
||||||
this.show = false;
|
this.show = false;
|
||||||
|
} else {
|
||||||
|
this.timedOut = true;
|
||||||
}
|
}
|
||||||
}, this.timeout);
|
}, this.timeout);
|
||||||
|
|
||||||
@@ -45,47 +48,22 @@ export default {
|
|||||||
|
|
||||||
if (toast) {
|
if (toast) {
|
||||||
toast.addEventListener("mouseenter", _ => {
|
toast.addEventListener("mouseenter", _ => {
|
||||||
if (timeout != null) {
|
|
||||||
clearTimeout(timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.mouseover = true;
|
this.mouseover = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
toast.addEventListener("mouseleave", _ => {
|
toast.addEventListener("mouseleave", _ => {
|
||||||
console.log("leaving", timeout, this.timeout);
|
this.mouseover = false;
|
||||||
this.show = false;
|
|
||||||
|
if (this.timedOut === true) {
|
||||||
|
this.show = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, 400);
|
}, 10);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
clicked() {
|
|
||||||
if (this.link) {
|
|
||||||
let resolved = this.$root.router.resolve(this.link);
|
|
||||||
|
|
||||||
if (resolved && resolved.route.name !== "404") {
|
|
||||||
this.$root.router.push(this.link);
|
|
||||||
} else {
|
|
||||||
console.error("Found a link but it resolved to 404. Link:", this.link);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.show = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
dismiss() {
|
dismiss() {
|
||||||
this.show = false;
|
this.show = false;
|
||||||
},
|
|
||||||
move(e) {
|
|
||||||
console.log("moving", e);
|
|
||||||
let target = e.target;
|
|
||||||
|
|
||||||
console.log("target", target);
|
|
||||||
|
|
||||||
var div = document.getElementById("target");
|
|
||||||
div.style.position = "absolute";
|
|
||||||
div.style.top = e.clientY + "px";
|
|
||||||
div.style.left = e.clientX + "px";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user