Как добавить всплывающую подсказку в значок панели навигации flexdashboard? - PullRequest
0 голосов
/ 24 марта 2020

У меня есть это приложение в R.

Как добавить всплывающую подсказку при наведении курсора на значок? Например:

enter image description here

Класс значков .fa-question-circle. Я пытался:

HTML:

<a href="#" class=".fa-question-circle" data-tooltip="My text is a text">Text</a>

CSS:

.fa-question-circle 
{
    position:relative;
}

.fa-question-circle:after
{
    background-color:rgba(0, 0, 0, .6);
    color: white;
    box-sizing:border-box;
    content: attr(data-tooltip);
    display:none;
    padding:5px;
    position:absolute;
    right: -105px;
    bottom: -55px;
    z-index:3;
    box-shadow: 0 0 3px #000;
    border-radius: 0px 10px 10px 10px;
}

.fa-question-circle:hover:after {
    display:block;
}

Но не работает. Спасибо.

Ответы [ 2 ]

1 голос
/ 24 марта 2020

Вы можете попробовать что-то вроде этого и удалить . из имени класса в вашем теге anchor.

.fa-question-circle {
  position: relative;
  display: inline-block;
  border-bottom: 1px dotted black;
}

.fa-question-circle .tooltiptext {
  visibility: hidden;
  width: 120px;
  background-color: black;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px 0;
  /* Position the tooltip */
  position: absolute;
  z-index: 1;
}

.fa-question-circle:hover .tooltiptext {
  visibility: visible;
}
<a href="#" class="fa-question-circle">Text
 <span class="tooltiptext">My text is a text</span>
</a>
1 голос
/ 24 марта 2020

Я нашел не ту часть. вам нужно использовать class="fa-question-circle" не class=".fa-question-circle"

.fa-question-circle 
{
    position:relative;
}

.fa-question-circle:after
{
    background-color:rgba(0, 0, 0, .6);
    color: white;
    box-sizing:border-box;
    content: attr(data-tooltip);
    display:none;
    padding:5px;
    position:absolute;
    right: -105px;
    bottom: -55px;
    z-index:3;
    box-shadow: 0 0 3px #000;
    border-radius: 0px 10px 10px 10px;
}

.fa-question-circle:hover:after {
    display:block;
}
<a href="#" class="fa-question-circle" data-tooltip="My text is a text">Text</a>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...