Copy link to clipboard
Copied
I have a burgermenu with an overlay using toggle to activate the overlay (upper right):
I used JS to rotate the burgermenu on toggle... the overlay/menu slides down .but i cant get it it to rotate back to the original position on a second toggle as the overlay/menu clears
my script (what I was trying is in bold):
To make the hamburger icon rotate on the first click and return to its original position on the second click, you can use the classList.toggle()
method in JavaScript. This method adds a class if it's absent and removes it if it's present, facilitating the alternation between two states.
Here's how you can adapt your code:
const bento_box_wrapper = document.querySelector('.bento_box_wrapper');
bento_box_wrapper.onclick = function() {
const overlayWrapper = document.querySelector('.over
...
I initially wanted it to rotate clockwise 45 degrees on the second toggle- so that it appeared to return to its original state yet all rotations would be clockwise - but this works..
Just alter the script a little bit - see additions in red below, plus a line commented out in green.
<script>
const bento_box_wrapper = document.querySelector('.bento_box_wrapper');
let rotate = 0;
bento_box_wrapper.onclick = function() {
const overlayWrapper = document.querySelector('.overlayWrapper');
overlayWrapper.
@REELHERO wrote:
Can I adjust the code so that it fades out completely before the new one comes in
Sure, just add a setTimeout function to the script which delays the text fading in by 1 second:
setTimeout(function() {
reviews[current].style.opacity = '1';
}, 1000)
@REELHERO wrote:
also I am trying to get all the reviews no matter what the length to justity right (or align right) so they all end at the far right of "PITCH LAB" but float and text align are not working
I would make your 'review_co
isnt that already in the original script though?
setTimeout(function() { reviews[current].style.opacity = '1'; }, 1500)
That one just fades in the initial review so you don't have to wait 5 seconds for it to appear.
I'm sure you have worked it out by now:
setInterval(function() { reviews.forEach((review) => { review.style.opacity = '0'; }); current = (current !== reviews.length - 1) ? current + 1 : 0;
setTimeout(function() { reviews[current].style.opacity = '1';
}, 1000)
}, 5000)
Copy link to clipboard
Copied
Works fine for me....at least the visa link.......you don't have the other movies linked as yet. What is it you expect to happen?
Copy link to clipboard
Copied
apologies I posted below i figured it out and corrected the regular page https://toddheymandirector.com/
they all work now-
my latest query.. I went for a new look with my pitchdeck site-- i was able to create a new type of burger menu upper left in css and return it to an "X" using a checkbox that i visual hid- but for some reason the checked class is preventing the overlay menu items from appearing
the test : https://pitchlab.net/checked_test.html
and the way it should work (without "checked"): https://pitchlab.net/
not sure why that css would prevent the overlay from working
ill post this in a new post so it doesnt get lost here
Copy link to clipboard
Copied
I figured it out - i had created a border correction div bc the body class was skewing the border for some reason..instead of figuring that out i just overlayed! a border to correct it.. Ive corrected the body class and removed the lazy correction i did and voila:
Copy link to clipboard
Copied
still havent figured out the link structure for the main page (below- I show what I was trying but its not working) but I did figure out the play/pause issue..
hit any thumbnail
https://toddheymandirector.com/reel/
it now autplays with PAUSE present when its playing on initial load.. (PLAY was present when it was playing and you had to hit it twice to correct)
in the script the .vjs-control-bar inside #controls-overlay had a click event to toggle play/pause. But it did not set the initial state to "playing". I set #controls-overlay to "vjs-playing" so the pause button is visible when the video starts and added event listeners for play and pause to dynamically toggle the play/pause button
Copy link to clipboard
Copied
Last question for now 🙂
if I wanted to add links to the videos on this page: https://toddheymandirector.com/ so that they can go to the film page ie
adding http://toddheymandirector.com/reel/movies/match to
name: 'match.mp4',
title: '<span class="dotted">the match</span>',
director: '<span class="cross">+</span>step up and shine<span class="cross">+</span>',
agency: 'Agency <span class="dot">•</span> Publicis'
},
how would i do that since it JS?
Copy link to clipboard
Copied
I initially wanted it to rotate clockwise 45 degrees on the second toggle- so that it appeared to return to its original state yet all rotations would be clockwise - but this works..
By @REELHERO
I'm glad this helped, in fact I was just applying the same logic you were already using for the other elements...
As for the visual animation of the icon, personally, I will simply set the .rotated
class to 180°
.bento_box_wrapper.rotated {
transform: rotate(180deg);
}
Letting the animation run in a clockwise direction, and on the second click return to its place using an anti-clockwise direction, which seems more natural to me.
Copy link to clipboard
Copied
thank you Lena - very helpful! if you have any thoughts about the pause/play button issue I mention above Id be grateful!
Copy link to clipboard
Copied
thank you Lena - very helpful! if you have any thoughts about the pause/play button issue I mention above Id be grateful!
By @REELHERO
Copy link to clipboard
Copied
sure !
I have an embedded movie player here:
https://toddheymandirector.com/reel/movies/visa/
when the movie begins to play, the 'PLAY' button is present.. it should be the PAUSE button. If you hit the play button twice it corrects and the PAUSE is present when playing and PLAY is present when the movie is paused.
So its not as if the CSS for both buttons is incorrect.
I imagine its somewhere in the API?
https://toddheymandirector.com/js/video3.js
or the script on the player page?
var movieElement = document.getElementById('movieElement');
$("#movie").addClass("initializing");
videojs(movieElement, { "autoplay": true, "controls": true, "preload": "auto" }, function() {
this.on("loadedmetadata", function() {
$("#movie").addClass("initialLoad");
setTimeout(function () { $("#movie").removeClass("initialLoad"); }, 3000);
$("#controls-overlay")
.append($(".vjs-control-bar"))
.on("click", function() {
if ($(this).is(".vjs-paused")) {
movieElement.player.play();
$(this).removeClass("vjs-paused").addClass("vjs-playing");
}
else {
movieElement.player.pause();
$(this).removeClass("vjs-playing").addClass("vjs-paused");
}
});
$("#movie").removeClass("initializing");
});
});
$(function() {
var video = $("video");
video.on("ended", function() {
var href = $(".next-project2").attr("href");
window.location = href;
});
});
Find more inspiration, events, and resources on the new Adobe Community
Explore Now