2016-10-06 9 views
0

ツールチップのような小さなポップアップ表示のテキストをイオンで表示します。だから私はここにTooltipster tooltipsterを使用している私のコードです:ツールチップを自動的に非表示にするには

.directive('tooltip', function() { 
    return { 
     restrict: 'C', 
     link: function (scope, element, attrs) { 
      if (attrs.title) { 
       var $element = $(element); 
       $element.attr("title", attrs.title) 
       $element.tooltipster({ 
        theme: 'tooltipster-default', 
        animation: attrs.animation, 
        trigger: "click", 
        position: "top", 
        positionTracker: true, 
        maxWidth: 500, 
        autoClose: true, 
        contentAsHTML: true 
       }); 
      } 
     } 
    }; 
}) 

は今、私はいくつかの時間後に自動を非表示にすることはできませんよ。私はexampleの次を使用しています。いずれかが閉めるのを助けることができますか? I午前も方法以下試してください。

$element.tooltipster('hide'); 
$element.tooltipster('destroy'); 

答えて

1

あなたは(ミリ秒単位)タイマーを試すことができ、イベントツールチップが詳細情報については、閉じる前に生きるべきhere

.directive('tooltip', function() { 
    return { 
     restrict: 'C', 
     link: function (scope, element, attrs) { 
      if (attrs.title) { 
       var $element = $(element); 
       $element.attr("title", attrs.title) 
       $element.tooltipster({ 
        theme: 'tooltipster-default', 
        animation: attrs.animation, 
        trigger: "click", 
        position: "top", 
        positionTracker: true, 
        maxWidth: 500, 
        timer:500, 
        autoClose: true, 
        contentAsHTML: true 
       }); 
      } 
     } 
    }; 
}) 
関連する問題