Answer the question
In order to leave comments, you need to log in
Why are links clicked on scroll in a responsive template?
Hello. There was an adaptive template on DLE. Moved it to wordpress. wp encountered a problem when working with mobile devices. When you scroll any page, you immediately click on the link that was under your finger at the time of the scroll. I don’t know how to describe it more precisely ... it’s better to look. Site: lechenie-kemerovo.ru
Maybe wp has some peculiarities in this regard? (never worked with it)
Or did I do something wrong?
Answer the question
In order to leave comments, you need to log in
function toggleSubmenuDisplay() {
document.addEventListener('touchstart', function(event) {
// ВОТ ЭТОТ КУСОК -- НАЧАЛО
if (event.target.matches('a')) {
var url = event.target.getAttribute('href') ? event.target.getAttribute('href') : '';
if ('#' !== url && '' !== url) {
window.location = url;
} else if ('#' === url && event.target.nextSibling.matches('.submenu-expand')) {
openSubMenu(event.target);
} else {
event.preventDefault();
}
}
// ВОТ ЭТОТ КУСОК -- КОНЕЦ
...
Now Captain is writing on my behalf, but what is available: when scrolling on a mobile phone, touching the screen and launches the function, which is why the link works. There is actually only one way out - to remove the script.
WP has no features, it just pulls data from the database. How they are displayed and what happens to them is a question for the topic (and the developer).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question