What I want to happen
- When hover over
Worksheet-Probleminput text, I want.button-addto show up and the user be able to click on it. When the user hovers away from theWorksheet-Probleminput text, I want.button-addto fade away. - When hover over
.button-bullet, I want.button-bulletto disappear and.button-removeto fade in its place
I feel like this should be simple enough. I might be using the incorrect jQuery functions.
What is actually happening
.button-add keeps blinking and coordination between.button-remove fadingIn and .button-bullet disappearing is a fail.
My code
I set the display of the .button-add and .button-remove to none. And then I toggled their display, as well as .button-bullet's display, using fadeIn() and fadeOut().
HTML
.button-add, .button-remove{
display: none;
}
jQuery
$("input[type='text'][name='Worksheet-Problem']").focus(function(){
$(".button-add").fadeIn(300);
})
$("input[type='text'][name='Worksheet-Problem']").hover(function(){
$(".button-add").fadeIn(300);
})
$("input[type='text'][name='Worksheet-Problem']").mouseout(function(){
$(".button-add").fadeOut(300);
})
$(".button-bullet").hover(function(){
$(this).hide();
$(".button-remove").fadeIn(300);
})
$(".button-remove").mouseout(function(){
$(this).fadeOut(300);
$(".button-bullet").fadeIn(300);
})


form-group) as that might provide better transitioning as they move back and forth. You can probably also reduce your code and usefadeToggleinstead offadeOutandfadeIn