ユーザーとコミュニケーションをとるためのさまざまなバブルを作成するメカニズムとして、BeautyTipsを使用しています。たとえば、詳細情報を含むバブルを表示するヘルプアイコンがあります。また、BTを使用してエラーメッセージと警告メッセージを表示します。
これが実際にはどのように見えるかです。
エラーメッセージが積み重ねられ、親メッセージが枯渇していることがわかります。
form_validatorには、errorPlacement引数の関数があります。
errorPlacement: function (er, el) {
if (el && el.length > 0) {
if (el.attr('id') == 'ContractOpenEnded') {
createErrorBubble($('#contractDuration'), er.text())
}
else {
createErrorBubble($(el), er.text());
}
}
}
これらの泡を作成するために重い物を持ち上げる関数は次のとおりです。
function createErrorBubble(element, text) {
// In a conversation with pcobar the spec was changed for the bubbles to be to the right of the element
createBubble(element, text, 2, "none", "right", "#fe0000", "#b2cedc", "#ffffff", true);
element.btOn();
}
ここではcreateBubble関数です。
function createBubble(element, content, messageType, trigger, positions, fillColor, strokeColor, foreColor, useShadow) {
var btInstance = element.bt(
content,
{
trigger: trigger,
positions: positions,
shrinkToFit: true,
spikeLength: 12,
showTip: function (box) {
$(box).fadeIn(100);
},
hideTip: function (box, callback) {
$(box).animate({ opacity: 0 }, 100, callback);
},
fill: fillColor,
strokeStyle: strokeColor,
shadow: useShadow,
clickAnywhereToClose: false,
closeWhenOthersOpen: false, // Closing when others open hides page validation errors. This should be false.
preShow: function (box) {
if (messageType != 1) return;
var whiteboard = $($(box).children()[0]);
var content = whiteboard.html();
if (content.substr(0, 5).toLowerCase() == "<div>") {
content = content.substr(5, content.length -11);
}
whiteboard.html('<div><span class="helpWarningPrefix">Warning:</span> ' + content + "</div>");
},
cssStyles: { color: foreColor },
textzIndex: 3602, // z-index for the text
boxzIndex: 3601, // z-index for the "talk" box (should always be less than textzIndex)
wrapperzIndex: 3600
});
}
この質問への答えは私を惑わしています。
アップデート:
これは実際には、ページの表示可能領域にないものに対してバブルを作成しようとすることの問題のように見えます。
編集:問題の名前をより明確に反映するようにタイトルを更新しました。