2012-01-17 11 views
0

したがって、QTip2はsuccesffulyで動作し、ツールチップをいくつかのajaxコンテンツのモーダルとして表示しています。モーダルツールチップ内のコンテンツに別のツールチップを呼び出すリンクがあることを除いて、すべてがうまくいっています。それらのいずれかをクリックすると、位置が画面外になります(-234.5pxや-300pxなど)。qツールチップ内でのヒントの配置

私は位置パラメータと関係があることを知っていますが、動作させることはできません。以前にクリックされたツールチップのターゲットをその位置として使用できるようにすることができますか?あるいは、新しいAjaxコンテンツを同じツールチップに読み込む方法はありますか?メインページ

リンク:アヤックス内

<a class="qtipajaxmodal" id="[id here]" href="[link here]" 
    rel="[ajax link here]">Main Link</a> 

リンクがコンテンツを引っ張っ:

<a class="qtipajaxmodal" id="[id here]" href="[link here]" 
    rel="[ajax link to somewhere else here]">Another Link</a> 

Qティップコード:

// Make sure to only match links to wikipedia with a rel tag 
     $('a.qtipajaxmodal').live('mouseover', function() { 
      // Make sure to only apply one tooltip per element! 
      if($(this).data('qtip') === 'object'){ return; } 

      $(this).qtip({ 
      id: 'modal2', 
      content: { 

      text: '<div class="ajaxqtipmodal-load" alt="Loading..."></div>', 
       ajax: { 
        url: $(this).attr('rel') 
       }, 
       title: { 
        text: 'Title: - ' + $(this).text(), 
        button: true 
       } 
      }, 
       events: { 
       show: function(event, api) { 
        // Grab the tooltip element from the API 
        var tooltip = api.elements.tooltip 
        // ...and here's the extra event binds 
        tooltip.find('.ui-tooltip-titlebar').show(); 
        }, 
        hide: function(event, api) { 
        //api.destroy(); 
        } 
       }, 
      position: { 
       target: $('#main'), 
       container: $('#main'), 
       my: 'center', // ...at the center of the viewport 
       at: 'center', 
       //viewport: $('#container'), 
       effect: false 
      }, 
      show: { 
       event: 'click', 
       solo: true, // Only show one tooltip at a time 
       modal: true, 
       effect: function(offset) { 
        $(this).show(400); // "this" refers to the tooltip 
       } // ...and make it modal 

      }, 
      hide: false, 
      style: { 
       classes: 'ui-tooltip-fd-movie' 
      } 
     }).click(function(event) { event.preventDefault(); }); 
     });[/code] 

答えて

0

私は同様の問題がありました。私はリンクが負荷時に見えるので、qTipはその位置を画面から外していると考えています。私はajaxコンテンツの読み込み後にqTipを新しいリンクに適用します。

編集:最初のQティップのショーイベントにQティップを追加

試してください:あなたはリンクが負荷で表示されていない

show: function(event, api) { 
    $(".qtipajaxmodal").qTip(...); 
} 
+0

を意味していますか?新しいリンクは、最初のqtipのajax呼び出しから生成されます。新しいコンテンツが読み込まれたらどのように適用しますか?それは別のクラスを与える?ご協力いただきありがとうございます! – chuuke

+0

これは、ショーのソロプロパティと関係がある。 trueに設定すると、現在のqTipとのqtipリンクは適切に位置を計算できません。ソロがオフのときは、うまくいくようです。私はqtipの中からqtipを取り出す必要があるたびにshow関数を入れ子にする必要がありますか?現在のqTipにコンテンツを入れる方法はありますか? – chuuke