【问题标题】:Unable to apply styles using " style option" in qtip无法使用 qtip 中的“样式选项”应用样式
【发布时间】:2015-06-11 15:29:16
【问题描述】:

我正在尝试使用文档styling demo 中给出的样式选项在 qtip 中应用样式,但它不会影响我的代码,它会覆盖 jquery.qtip.min.css 样式类.有什么方法我可以同时使用,但优先考虑 style 选项

这是我的参考代码

html代码:

<div id="styleChange1" class="innerDiv">Hover to get styled qtip</div>

js代码:

$(document).ready(function() {
     $("#styleChange1").on({
           mouseover: function () {
               ShowQtip(element1,"bottomMiddle","bottomMiddle","topMiddle") ;
           },
           mouseleave: function () {
                $(this).qtip("destroy");
           }
    });
});

function ShowQtip(element,contentTxt,position1,position2) {
    if(element == null)
        return
    element.qtip({
        content: contentTxt,
        show: true,
        position: {
            my: position1,  // Position my top left...
            at: position2
        },
        hide: {
            event: false
        },
        style: { 
            width: 200,
            padding: 5,
            background: '#A2D959',
            color: 'black',
            textAlign: 'center',
            border: {
            width: 7,
            radius: 5,
            color: '#A2D959'
        }, 
        tip: contentTxt,
        name: 'dark' // Inherit the rest of the attributes from the preset dark style
   });
}

请任何建议都会有很大帮助。

【问题讨论】:

标签: jquery html css qtip qtip2


【解决方案1】:

尝试使用此代码...

$("jqueryselector").qtip({
   content: 'Stems are great for indicating the context of the tooltip.',
   style: { 
      tip: { // Now an object instead of a string
         corner: 'topLeft', // We declare our corner within the object using the corner sub-option
         color: '#6699CC',
         size: {
            x: 20, // Be careful that the x and y values refer to coordinates on screen, not height or width.
            y : 8 // Depending on which corner your tooltip is at, x and y could mean either height or width!
         }
}  }  });

【讨论】:

  • 谢谢,我已经尝试过了,但没有任何变化,你能编辑我的小提琴并更新变化
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-04-01
  • 2021-12-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多