您好,我的 Web 应用程序中有一个 jQuery qTip 工具提示,我正在尝试为工具提示中的图像设置相对路径。
我的代码是:
$('#behind-the-behaviour span[title]').qtip({
content: { title: { text: "Behind the Behaviour" }, text: "<img src='~/Images/behindbehaviour.png'/>" },
style: { border: { radius: 5 } },
show: { effect: function () { $(this).show(); } },
hide: { effect: function () { $(this).hide(); } },
position: { my: 'rightTop ', at: 'left center', target: this, viewport: $(window) },
});
它需要是相对的,因为这是一个由不同文件夹中的页面继承的母版页。当路径设置为“Images/behindbehaviour”时,文件夹页面无法访问它
如何让jquery通过相对路径找到图片?谢谢!
最佳答案
尝试:
text: "<img src='/Images/behindbehaviour.png'/>"
没有波形符 (~)
这对我有用。
关于javascript - jQuery qTip 图像源相对路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27523699/