javascript - 工具提示功能和 CSS

标签 javascript jquery html css

我正在使用以下 jQuery 来设置工具提示的样式

  $(function() {

        // select all desired input fields and attach tooltips to them
      $("#tooltips :input").tooltip({

      // place tooltip on the right edge
      position: "center left",

      // a little tweaking of the position
      offset: [-2, 10],

      // use the built-in fadeIn/fadeOut effect
      effect: "fade",

      });
    });

我的 CSS 是

#myform {
    height: auto;
  }
  #tooltip{
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  background-color: #fff !important;
  border: 1px solid !important;
  border-radius: 5px;
  border-color: #bbb #bbb #a8a8a8;
  padding: 16px;
  z-index: 2000 !important;
  width: 255px;
  line-height: 17px;
  top: 48px;
  margin-left:-16px !important;
  font-style: italic;
  color: #7d7d7d;
  font-size: 13px;
  -webkit-transition: all 0.218s;
  -moz-transition: all 0.218s;
  -o-transition: all 0.218s;
  transition: all 0.218s;
  }
#tooltip:after {
        content: '';
        position: absolute;
        border: 3px solid rgba(51, 51, 51, 0.9);
        border-color: transparent white;
        border-width: 8px 0 8px 7px;
        top: 40%;
        right: -6px;
}

#tooltip:before {
        content: '';
        position: absolute;
        border: 2px solid #333;
        border-color: transparent #000;
        border-width: 8px 0 8px 6px;
        top: 40%;
        right: -6px;
}

我想将 CSS 名称更改为任何其他名称而不是工具提示,但是当我更改我的 CSS 名称时,工具提示不起作用。

任何帮助将不胜感激

最佳答案

不确定你想问什么,但是如果你想用 CSS 中的任何其他字符串替换 'tooltip',比如 'test' 那么你必须替换 $('#tooltip :input ') 同名 $('#test :input')

关于javascript - 工具提示功能和 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22808776/

相关文章:

javascript - VueJS : How to Access the Previous Item in v-repeat

javascript - 如何实现容器类的延迟加载?

javascript - 根据其他选择下拉列表填充选择下拉列表

html - 如何强制 div 内容对齐?

javascript - pic在 Canvas 上随机画圆函数

javascript - 更改 Google map 自动完成字段的值

javascript - 窗口onload功能无法正常工作?

javascript - 如何在 jQuery 中引用当前选中的元素?

jquery - 使用 Dynatable 插件更新表格

javascript - 如何拦截不同JS库发出的所有AJAX请求