I'm trying to drag an element from 1 block to another, depending on the width of the screen. When you repeatedly call a function, elements accumulate and instead of 1 are added incrementally. How to fix? On the local server, everything works well, after the Gulf to the Internet is buggy.
function sizesLink() { if (window.matchMedia("(max-width: " + mediaMd + "px)").matches) { if ( !($('.sizes-container').is(':has(.sizes-link)')) ) { $('.sizes-container').append($('.sizes-link')); } } else { if ( !($('.st-wrapper').is(':has( > .sizes-link)')) ) { $('.st-wrapper').append($('.sizes-link')); } } }