Раздел раскрывающегося списка HTML не переместится в раздел href.CSS

Разбираемся в CSS
Ответить Пред. темаСлед. тема
Anonymous
 Раздел раскрывающегося списка HTML не переместится в раздел href.

Сообщение Anonymous »


Hi I am trying to set a dropdown that can move to sections specified in herf

here is my initial code

Menu According to this, about should go to the about section and projects to projects as mentioned in herf tags
but the li a are not getting clicks or cannot process them.

I have tried this js below that I took from another stack post - I did change the herf to data-herf when i was attempting this - Yet I could not resolve this.

$(document).ready(function() { $('a[data-href]').click(function(event) { event.preventDefault(); var sectionToNavigate = $(this).attr('data-href'); if(sectionToNavigate && $(sectionToNavigate).length) { $('html, body').animate({ scrollTop: $(sectionToNavigate).offset().top }, 1000); } }); }); I have read other posts which concludes it as a browser issue. But I have tried edge, chrome and brave none seem to be working.


Источник: https://stackoverflow.com/questions/781 ... ef-section
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «CSS»