Why does my link break (stop navigating to its location) when I use data-toggle attribute?

后端 未结 1 615
旧巷少年郎
旧巷少年郎 2021-01-28 00:50

I am having a play around with Bootstrap 4 in Rails 5 and I am trying to get a data-toggle to work on nav-pills.

With my code below, the

1条回答
  •  礼貌的吻别
    2021-01-28 01:34

    If by "breaking the link", you mean that browser no longer navigates to a new page, then it's because bootstrap's javascript intercepts the click on the link to do the toggling.

    Clicking on a link takes you to its location, a new page. Clicking a toggle element shows/hides some other element on the current page. You can't have both.

    0 讨论(0)
提交回复
热议问题