JSFiddle - React, Tailwind, and code Playground
HTML
<div style="height: 1500px;">
<div id="MySideDiv" style="width: 55px; height: 15px; background: red; position: fixed; right: -55px;">
</div>
</div>
JavaScript
var isVisible = false;
$(window).scroll(function() {
var height = $(window).scrollTop();
var div = $("#MySideDiv");
if(height > 350 && isVisible === false) {
div.clearQueue().stop().animate({ "right": 0 }, 'slow');
isVisible = true;
} else if (height < 350 && isVisible === true) {
div.clearQueue().stop().animate({ "right": '-55px' }, "slow");
isVisible = false;
}
});