When I click a button, a pop-up appears. My goal is to prevent this pop-up from scrolling when it reaches the menu on my website.
Here is the code snippet:
<div id="dialog_box" class="dbox" style="display: none; position: fixed;
right: 192px ! important; z-index: 1000; top: 0px;">
I am attempting to stop the scrolling of #dialog_box when it reaches the div with the ID #menu using jQuery or JavaScript.
So far, my attempts have not been successful:
jQuery(window).scroll(function(){
jQuery('#dialog_box').scrollTo('#menu'); // I want to halt scrolling when dialog_box reaches #menu.
jQuery("#dialog_box").css("top", Math.max(0, 162 -
jQuery(this).scrollTop())); // I tried positioning dialog_box from the top but it did not give me the desired outcome.
});