I can use toggle, fadeToggle etc… But I can’t find a way to toggle to an opacity of 0.20 or something like that. I’ve searched the internet, but not found a proper solution. Anyone?
Why are you using Jquery to do it?
Otherwise I need too many timelines.
You can set opacity with the Hype JavaScript API!
I can do this:
$(document).ready(function() {
$(".vk").toggle(document.getElementById("vk").style.opacity = "0.5");
});
But how to get back to opacity 1.0?
edit:
No this does not work, because it has to stop at n opacity of 0.5. It now completely disappears.
this works, so far that it returns to opacity 1.0.
$(document).ready(function() {
$(".vk").fadeToggle(document.getElementById("vk").style.opacity = "0.5", function() {
document.getElementById("vk").style.opacity = "1.0";}
);
Now it needs to stop at 0.5
let someElement_ = hypeDocument.getElementById('someElement')
let someElement_Opacity = hypeDocument.getElementProperty(someElement_, 'opacity')
console.log(someElement_Opacity);
someElement_Opacity == 1 ? hypeDocument.setElementProperty(someElement_, 'opacity', 0.5, 1.0, 'easeinout') :
hypeDocument.setElementProperty(someElement_, 'opacity', 1.0, 1.0, 'easeinout');
3 Likes
Nice solution. Thank you for that!