I have an image, and on click of a button/image, I want to display an “overlay” over the image. The overlay will have a button to click, and by clicking it, the overlay disappears.
I am able to achieve this with the following code:
So by clicking the “button.png” image, a click event is handled changing the visibility of the Panel, which will be displayed through the following JavaScript code:
var Observable = require("FuseJS/Observable");
var Panel1Visibility = Observable("Collapsed");
function click() {
if (Panel1Visibility.value == "Visible") {
Panel1Visibility.value = "Collapsed";
} else {
Panel1Visibility.value = "Visible";
}
}
module.exports = {
Panel1Visibility: Panel1Visibility,
click: click
};
The question I’m having is how do I animate the overlay to be a fade-in for example? With my current solution, the overlay comes immediately. Where do I add the fade-in animation, and how do I do it?
I personally would go with the “blue” approach, not the “red” one. But it really depends on your use-case; sometimes the “red” one will make more sense.