Мне нужно скрыть всплывающую подсказку, если контент не найден. Пытаюсь заставить его работать, но, кажется, безрезультатно. Я использую более старую версию qtip, которая называется jquery.qtip-1.0.0-rc3.js. я пытался использовать
if (!html) {
$(this).remove();
}
это сработало. Он показывал только изображения всплывающей подсказки с содержимым, но при наведении курсора всплывающее окно не появлялось. Ниже приведен мой полный код всплывающей подсказки. Пожалуйста помогите. Что мне здесь не хватает?
$(document).ready(function () {
$(".form-field").each(function () {
var optionLabel = $(this).children('.form-label');
var optionLabelText = optionLabel.text();
if ($("img", this).length < 1) {
$(this).children('.form-label.form-label--alternate.form-label--inlineSmall').append(" <div class='help_div' style='float:right;'><img src='/content/help.png' alt='" + optionLabelText + "'/></div>");
}
});
$('.help_div').each(function () {
var slug = slugify($("img", this).prop('alt'));
console.log(slug);
var html = $("#" + slug).html();
var titleq = $("img", this).prop('alt').replace(/[^-a-zA-Z0-9,&\s]+/ig, '');
titleq = "<strong style='font-size: 12px'>" + titleq + "</strong><br/>"
if (!html) html = "Description not available yet."
$(this).qtip({
content: html,
position: {
corner: {
tooltip: 'topRight',
target: 'bottomLeft'
}
},
style: {
tip: {
corner: 'rightTop',
color: '#6699CC',
size: {
x: 15,
y: 9
}
},
background: '#6699CC',
color: '#FFFFFF',
border: {
color: '#6699CC',
}
}
});
});
function slugify(text) {
text = text.replace(/[^-a-zA-Z0-9,&\s]+/ig, '');
text = text.replace(/-/gi, "_");
text = text.replace(/^\s+|\s+$/g, "");
text = text.replace(/\s/gi, "-");
text = text.toLowerCase();
return text;
}
});
. help_div
,.form-field
или оба случая? - person Ignacio Catalina   schedule 20.09.2018.help_div
- person user6345655   schedule 20.09.2018