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
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('.overlayWrapper');
overlayWrapper.classList.toggle('overlayWrapperSlideDown');
const mainNavLinksWrapper = document.querySelector('.mainNavLinksWrapper');
mainNavLinksWrapper.classList.toggle('mainNavLinksWrapperSlideUp');
// Add or remove the 'rotated' class to manage the rotation
bento_box_wrapper.classList.toggle('rotated');
}
In this script, the rotated
class is added or removed with each click on the .bento_box_wrapper
element. You can define this class in your CSS to handle the icon's rotation:
/* Initial style of the icon */
.bento_box_wrapper {
/* Your initial styles */
transition: transform 0.3s ease; /* Adds a transition for smooth rotation */
}
/* Style when the icon is rotated */
.bento_box_wrapper.rotated {
transform: rotate(315deg); /* Desired rotation angle */
}
With this approach, the icon rotates 315 degrees on the first click and returns to its original position on the second click, thanks to the toggling of the rotated
class.
For a visual demonstrationyou can access there https://demo.puce-et-media.com/reelhero/index-2.html
Copy link to clipboard
Copied
Thank you Lena - I didnt think to use css.. I even added the same additonal spacing I used in the hover state to that rotate css - so its consistent with the hover state..
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..
quick question not related but on my personal site - no one seems to be able to help me but while I have you..
this may be in the API of the player but I cannot figure it out
hit any thumb to bring up a movie here https://toddheymandirector.com/reel/
the bottom icon in the player is a play button (should be a pause bc it is playing) however if you hit it it stays on a play button but pauses - hit it one more time and it returns to normal function ie pause button shows up when its playing and vice versa - very strange..
any help would be appreciated!
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..
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.classList.toggle('overlayWrapperSlideDown');
const mainNavLinksWrapper = document.querySelector('.mainNavLinksWrapper');
mainNavLinksWrapper.classList.toggle('mainNavLinksWrapperSlideUp');
rotate = rotate + 405;
bento_box_wrapper.style.transform = `rotate(${rotate}deg)`;
// Add or remove the 'rotated' class to manage the rotation
// bento_box_wrapper.classList.toggle('rotated');
}
</script>
In reference to your other issue regarding the play/pause button it's best to ask the developer of the script. The script uses jQuery which I'm not totally familar with BUT it would seem you need to add the pause button when the page initially loads. I would have thought this would be one of the options available as the script uses an 'auto' play option on page load, so why would you want to show a play button initially if that option is selected.
Copy link to clipboard
Copied
Osgood! nice to see you here..
thank you - subtle change but i think its more elegant with the continuous direction..
And re the other issue - Yes it makes no sense.. I employed it several years ago ( not sure I even remember where I got it ) so its possible when i customized it I adjusted the API incorrectly or even the style incorrectly.. but the pause should be present when the page loads.. however if you click the play twice it self corrects and the pause shows when play and play when paused which is the right way.. thats whats so confounding..
Copy link to clipboard
Copied
subtle change but i think its more elegant with the continuous direction..
By @REELHERO
I agree in this case.
Not sure quite what was happening before but it seemed to be turning anti clockwise on the first click, which felt counter intuitive to me.
I think had it been going in a clockwise direction on first click and then anti clockwise on the second click it would have been passable.
As it is l quite like it rotating clockwise on each click.
Copy link to clipboard
Copied
I like it too.. I still have to figure out that play pause issue but Ill table it while I get this site up.. (sent you a message btw.. something I wrote for the hollywood reporter you might appreciate 🙂 not coding related 🙂
Copy link to clipboard
Copied
I could create a seperate post about this but while I have you- this is more of a question-
I added a little fade-in and out review sequence (below the video)
with pure css.. however I want it to loop continuously - there are temp lines in there but Ill have 6-8 -
but I believe I need JS for that.. is that correct? Can you point out how i might do that?
Copy link to clipboard
Copied
I added a little fade-in and out review sequence (below the video)
with pure css.. however I want it to loop continuously - there are temp lines in there but Ill have 6-8 -
but I believe I need JS for that.. is that correct? Can you point out how i might do that?
By @REELHERO
The below should work.
<style>
#review_container {
position: relative;
}
.reviewText {
font-size: .9vw;
font-family: "kanitlight", sans-serif;
font-weight: 100;
letter-spacing: .05vh;
color:#022d2c;
position: absolute;
line-height: 1;
transition: opacity 1s ease;
opacity: 0;
}
</style>
<div id="review_container">
<h1 class="reviewText">Top designers to help elevate your film, commercial, or music video pitch decks</h1>
<h1 class="reviewText">100% hit rate whenever we used Pitch lab helping us crush the competition - A24</h1>
<h1 class="reviewText">The deck was napalm by the time we hit the room they were sold and floored - Tool</h1>
</div>
<script>
let current = 0,
reviews = document.querySelectorAll(".reviewText");
setTimeout(function() {
reviews[current].style.opacity = '1';
}, 1500)
setInterval(function() {
reviews.forEach((review) => {
review.style.opacity = '0';
});
current = (current !== reviews.length - 1) ? current + 1 : 0;
reviews[current].style.opacity = '1';
}, 5000)
</script>
Copy link to clipboard
Copied
i knew you would come up with a better js solution -
right now they cross-dissolve
https://pitchlab.net/index_test.html
Can I adjust the code so that it fades out completely before the new one comes in like here:
I can adjust the other timing i just can figure out how to make it go to opacity:0 before the new review fades in..
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
Copy link to clipboard
Copied
@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_container' width 100% and give it the same right position as your 'review-title' css class
#review_container{
position: fixed;
right: 10vw;
width: 100%;
bottom:24vh;
}
Then apply width: 100% to your 'reviewText' css class. You have 2 declarations of the .reviewText css class, so I would remove one, so only the values below are present.
.reviewText {
font-size: .9vw;
font-family: "kanitlight", sans-serif;
font-weight: 100;
letter-spacing: .05vh;
color:#022d2c;
position: fixed;
line-height: 1;
transition: opacity 1s ease;
opacity: 0;
text-align: right;
width: 100%;
}
See if that positions the text where you require it to be.
Copy link to clipboard
Copied
isnt that already in the original script though?
let current = 0, reviews = document.querySelectorAll(".reviewText"); setTimeout(function() { reviews[current].style.opacity = '1'; }, 1500) setInterval(function() { reviews.forEach((review) => { review.style.opacity = '0'; }); current = (current !== reviews.length - 1) ? current + 1 : 0; reviews[current].style.opacity = '1'; }, 5000)
Copy link to clipboard
Copied
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
apologies - I did - admitedly it took me a while.. and i put it up on the main page.. and adjusted the timing:
works perfectly thank you - I am still a novice at JS.. !
speaking of..my last question is below if you ever get a sec please lmk the best way to add a link to the opening movie sequences movies (a producer requested it) - its confusing because its JS and i only know how to add a link to html or css.. but here Im not sure of the structure :
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'
},
Copy link to clipboard
Copied
Who did or how was the 'reel' page set up, that has links to the movies player page/s? Have you tried copying the same link structure from that page.
Seems to me that the movies are stored in their own seperate folders, so it seems logical that just linking to the appropriate folder should work?
Copy link to clipboard
Copied
I tried that exactly but Im not sure of the link structure with JS-
I tried this:
{
name: 'match.mp4',
title: '<span class="dotted" <a href="https://toddheymandirector.com/reel/movies/match/">the match</a></span>',
director: '<span class="cross">+</span>step up and shine<span class="cross">+</span>',
agency: 'Agency <span class="dot">•</span> Publicis'
},
and this
{
name: 'match.mp4',
title: '<span class="dotted" href="https://toddheymandirector.com/reel/movies/match/">the match</span>',
director: '<span class="cross">+</span>step up and shine<span class="cross">+</span>',
agency: 'Agency <span class="dot">•</span> Publicis'
},
what am I getting wrong?
Copy link to clipboard
Copied
Try closing the span tag in the first version, should be an > after the "dotted" class name
The second version won't work as a link requires an anchor tag wrapped around it.
Copy link to clipboard
Copied
I did that and it indicated theres a link there (its blue..havent added a a:link class for the color yet) but it isnt clickable
https://toddheymandirector.com/index_test.html
I did VISA and MATCH and theyre both blue
I tried adding a z-index but no go - is it possible to make the whole video container linkable?
Copy link to clipboard
Copied
is it possible to make the whole video container linkable?
Wrap an a href around the video container.
Copy link to clipboard
Copied
how would i do that within a script? I know how with a <div> but where in here would i wrap this if i cant even make a <span> linkable
{
name: 'visa.mp4',
title: '<span class="dotted"><a href="https://toddheymandirector.com/reel/movies/visa/"><a href="#">visa</span>',
director: '<span class="cross">+</span>saturday<span class="cross">+</span>',
agency: 'Agency <span class="dot">•</span> Wieden & Kennedy'
},
Copy link to clipboard
Copied
Have you tried disabling all the css to test if the link works?
Have you tried the a tag on its own without the span tag wrapping it?
If you can see the link but can't click on the link it would suggest to me that something is blocking it. A good way to test is to disable all the css.
Copy link to clipboard
Copied
i did that and the link is functional so it has to be something in the css:
https://toddheymandirector.com/index_test2.html
Ill trouble shoot it
Copy link to clipboard
Copied
while Im troubleshooting.. what should i look for that could conflict in the css? the only think i can think of if its showing as blue (ie a link) but not clickable is z-index..? is there something else I should be looking for?
Copy link to clipboard
Copied
I think z-index will only work if an item is positioned relative or absolutely.
If the link is not clickable when css is applied it means something else is overlaying the link. It could possibly be an overlay.
Copy link to clipboard
Copied
i figured it out- for some reason the body class was skewing the border.. so instead of figuring that out I added a (dreaded) overlay with a border to correct it.. I figured out the body class issue removed the correction and voila: https://toddheymandirector.com/index_test.html
and thank you for letting me figure it out instead of giving me the answer it helped me to learn
Find more inspiration, events, and resources on the new Adobe Community
Explore Now