2016-08-12 70 views
1

qtip2 positioning problem 我想定位qTips在div下,如上所示。提示與容納目標的容器(A,B,C)的寬度相同。我試圖讓小費直接放在容器的下方,但我希望角落能夠相對於目標定位自己。qTip2:定位尖端,並定位角落

如何配置qTip2以獲得此對齊?

目標B是簡單的......

position: { 
     my: 'top center', 
     at: 'bottom center' 
    }, 
    style: { 
     width: 350, 
     tip: { 
      height: 10, 
      width: 12 
     } 
    }, 

但瞄準A和C給我找麻煩

如果我加入一些style.tip CONFIGS爲目標答:

position: { 
     my: 'top center', 
     at: 'bottom center' 
    }, 
    style: { 
     width: 350, 
     tip: { 
      height: 10, 
      width: 12, 
      corner: 'top left', 
      mimic: 'center' 
     } 
    }, 

拐角不在目標的中心位置......它離開左側

如果我添加一個tip.offset,那麼拐角看起來是正確的偏移,但是整個尖端移動了一個等量,不再與容器對齊。

position: { 
     my: 'top center', 
     at: 'bottom center' 
    }, 
    style: { 
     width: 350, 
     tip: { 
      height: 10, 
      width: 12, 
      corner: 'top left', 
      mimic: 'center', 
      offset: 60 // about half the width of Target A 
     } 
    }, 

如何配置qTip2得到這個技巧與容器對準,並且邊角與目標一致?

回答

0

這裏是我如何解決它:

爲靶標A

position: { 
    my: 'top center', 
    at: 'bottom center' 
}, 
style: { 
    width: 350, 
    tip: { 
     height: 10, 
     width: 12, 
     offset: -120 // offset from the center 
    } 
}, 

用於靶向B

position: { 
    my: 'top center', 
    at: 'bottom center' 
}, 
style: { 
    width: 350, 
    tip: { 
     height: 10, 
     width: 12, 
     offset: 120 // offset from the center 
    } 
},