āBut if you go here to my link: https://codepen.io/IDCoder/pen/LrQRrw?editors=0110 2, you will see that after you mouseout off the animation slides, the green dot is still blinkingā¦ā This comment that I had stated previously, was wrong. Thatās supposed to happen.
What I meant to say was, on mouseOver, the green button is no longer blinking with the glowing green color (class = glow-green), but rather the .green class is still blinking (dark green). The button does not become static. Neither the .green-color class or the .green class should be blinking on mouseOver. The button should just be still. Thatās the goal.
It looks like youāre running into race conditions because setInterval is asynchronous. If you hover over the dropdown and wait a couple sec, youāll see it stops. So itās waiting to finish all the queued calls to setInterval
I also donāt know why, but using jqueryās fadeToggle method allowed me to stop the animation faster. I did have to force display it since jquery modifies the opacity in the style prop and that overrides all classes.
function blink_greenLight() {
$('.glow-green').fadeToggle(100);
}
document.getElementById("showcase").addEventListener("mouseover", mouseOver);
function mouseOver() {
clearInterval(myVar);
$('.glow-green').show()
}
Then another race condition popped up. There is a 50/50 chance at stopping the timer on display: none.
So instead of using jquery for this, Iād say the best solution is to use a class for the strobe effect. Then you could synchronously add/remove the class as needed to avoid race conditions
I love the idea of using a class for the strobe effect! But check this out. Scroll down to the animated slides, and hover over the slides. Do you see the green button that is blinking? That is what I want to totally eliminate. Iām beginning to wonder if my idea is too complicated and if my goal maybe unacheivable.
Also, I see that when you hover over the content of the drop-down menu, unlike before, the green light stops flashing. I want the green light to keep blinking because it represents the fact that the slideshow animation is still in session.
Thankyou IMMENSELY, for all the help you have given so far!
Now, upon going over everything, here is what I see. I have a circle element of which, in HTML, the classes are green and glow-green.
In CSS, you added an animation class .animate-flicker.
In javascript/jQuery, you assigned the rule of the animation class (.animate-flicker) to .green.
Then you did this: $(".green").removeClass("glow-green").removeClass('animate-flicker') }); ā¦which removes the .glow-green class from the circle, as well as removes the animation class from that .green class on mouseover of slides in slideshow.
And, then you have this for the mouseoutfunction: $(".green").addClass("glow-green").addClass('animate-flicker')}); This adds the .glow-green class back to the circle element as well as adds the animation class to that .glow-green class.
All in all, a seamless interaction of javascript and CSS working in tandem! So happy! Cheers man!
@JM-Mendez, unfortunately, now itās back to the same behavior - in GitHub, even though it works in Code Pen! WTF! LOLā¦no errors logged in the console eitherā¦
In your Code Pen, the cessation of the blinking goes into effect immediately, but in GitHub, there is a delay, before it goes into effect. Why would that happen in GitHub but not in Code pen?? Weird!
I took a look at the sources tab in devtools, and you still have this in your profile.js file
//part A (of Part 1)
$(".green").addClass("animate-flicker");
// remove this
var myVar= setInterval(blink_greenLight, 100);
function blink_greenLight() {
$('.glow-green').fadeOut(100);
$('.glow-green').fadeIn(100);
}
@JM-Mendez, good Lord! Finally finish with this arduous task! 30 messages later! Haha!
How long have you been programmin/developing with Javascript, and just web in general?
Lol. It does get very frustrating at times. Some days I canāt even look at my computer without getting angry. lol
Iāve been learning javascript, well programming period since Jan '17. But Iāve been toying with computers since 2006. Mostly copy pasting stuff to build linux machines and hackintoshes. Some iPhone/android jailbreaking stuff too.
Since I didnāt know any programming I spend most of my days fighting the inspector tools and googling cryptic error messages. Honestly I feel itās the only reason Iāve been able to pick it up quickly. I guess I learned to troubleshoot before learning to code. lol
But itās not like it all clicked right away either. I feel there just comes a point where you start seeing the same types of errors. Eventually it all clicks if you stick with it