2016-09-27 87 views
5

我在我的區域地圖tooltop,我已經做了,我正在使用http://qtip2.com/變更提示位置/箭頭

我的代碼時,我調用提示在這個問題Tooltip on map area tag

jQuery(document).ready(function (e) { 
jQuery('area').qtip({ 
    style: { 
     classes: 'qtip-dark' 
    }, 
    events: { 
     show: function(event, api) { 
      api.set({ 
       'content.text': api.elements.target.attr('title') 
      }); 
     } 
    } 
}); 
}); 
同一個

但是我的工具提示總是在我的區域的右下角,有什麼方法可以讓我在它的右上角?

+0

試試這個,我的': 「右下方的」','在:頂部right','調整:無none',你也可以檢查一下這個演示頁面:[點擊這裏](HTTP:/ /qtip2.com/demos) –

+0

您可以根據「event.pageX」和「event.pageY」創建條件。 –

+0

@chiragpatel我可以在哪裏插入這些屬性? – MattDAVM

回答

0

感謝Chiral Patel的評論我找到了一種方法,謝謝!

jQuery(document).ready(function (e) 
        { 
         jQuery('area').qtip({ 
          style: 
          { 
           classes: 'qtip-default qtip qtip-light qtip-rounded', 
           width: '250px', 
           height: '70px', 

          }, 
          position: 
          { 
           my : 'bottom left', 
           at: 'top right', 
           method:'none' 
          }, 
          events: 
          { 
           show: function(event, api) 
           { 

           api.set 
           ({ 
            'content.text': api.elements.target.attr('title') 
           }); 

           } 
          } 
          }); 
        }); 
1

找到下面的答案它會對你有幫助。

jQuery(document).ready(function (e) 
        { 
         jQuery('area').qtip({ 
          style: 
          { 
           classes: 'qtip-default qtip qtip-light qtip-rounded', 
           width: '250px', 
           height: '70px', 
           tip: true 

          }, 
          position: 
          { 
           my : 'bottom left', 
           at: 'top right', 
           adjust: { 
            method: 'none none', // Requires Viewport plugin 
            resize: true 
           }, 
          }, 
          events: 
          { 
           show: function(event, api) 
           { 

           api.set 
           ({ 
            'content.text': api.elements.target.attr('title') 
           }); 

           } 
          } 
          }); 
        });