2

ビューティー ヒント プラグインをどのように更新しますか? クリック イベント時に要素に適用されるビューティー ヒントを変更しようとしています。どちらでも嬉しいです

  1. クリックされたときにその要素のビューティ ヒントを無効にするか、

  2. クリックすると美容のヒントの内容が変わります。

「options」配列を問題なく変更できるようですが、その変更が美容のヒントに反映されていません。

4

2 に答える 2

1

I had the same problem recently; in my case I needed to update a tooltip on the parent element of a select whenever the selection changed (with the tooltip contents based on the title element of the selected option). To get the tooltip to update on an element, i.e. to get its contents to change, you need to:

  1. remove the attribute that BT uses to store the original title (so that it doesn't think it's already handled the element),

  2. set the element's title attribute to the new content you wish to display in the updated tooltip,

  3. call the bt() function again to create the updated tooltip.

For instance:

element.removeAttr('bt-xtitle');
element.attr('title', 'new tooltip content');
element.bt();

Obviously this assumes that you're using the default title attribute to generate the content, if you're using a custom contentSelector like a div, you'll need to adjust the code accordingly but the concept should remain the same.

Hopefully this can help someone trying to achieve the same thing, since it's not very intuitive how to do this.

于 2012-11-01T09:12:13.210 に答える
1

要素で BT を無効にするには、次の構文を使用します。

$('selector').btOff(); 

BT の使用を再度有効にするには:

$('selector').btOn();
于 2010-10-16T09:10:03.373 に答える