I have a slider that should activate the JS function. The user can move the cursor from the slider itself, but continue dragging the slider by holding the left mouse button, but when the slider is moved to the right place, the user releases the left mouse button not at the slider, but somewhere at a random point on the screen, the function will not work, this options with $(document).click disappear.
I wrote the following version, perhaps some kind of collective farm, but still for an example:
$(document).on('mousedown', '#id', function (){ $(window).click(function (){ // Код всей функции } } Now I ran into the problem that when you first load the page everything is fine, the code works as it should, but when you re-act, the function starts to work when you click at any point on the screen, ignoring it $(document).on('mousedown', '#id', function () How to make these 2 events work according to the principle
if(условия1 && условие2){ //Выполняю } PS $(window).click(function () used it specifically to pick up a click even if the user moved the cursor off the slider.