[Solved] Sidebar hide/show button that follows cursor mouse? [closed]


if you could provide some of your source html and css i could get you a more specific answer, but using CSS and JQUERY similar to my example below should give you the effect you are looking for…

the process is listening to the mousemove event with jquery and storing the mouse’s Y position in a js variable. then we are adjusting the ‘.button’s CSS to match that value.

specifically this method is going to rely on your button having an absolute position with a value declared for TOP.

HTML

<div class="button"></div>

JS

var posY;

$(document).mousemove( function(e) { 
   posY = e.pageY;
    $('.button').css({'top': posY});
});  

CSS

.button {
    top:0px;
    position:absolute;
    /* ... */
}

you can find it all together here in a fiddle with the button moving vertically to follow the mouse

solved Sidebar hide/show button that follows cursor mouse? [closed]