gpt4 book ai didi

iphone 3/4 背景图像 url 常量路径失败

转载 作者:行者123 更新时间:2023-11-28 12:47:50 27 4
gpt4 key购买 nike

我有简单的 jQuery 代码来更改背景图像。

        $("#headerimg" + activeContainer).css({
"background-image" : "url(" + photoObject.image + ")",
"display" : "block",
"z-index" : currentZindex
});

当我将背景图片作为相对路径插入时,它起作用了

display: block; background-image: url("./wp-content/images/2013/02/turkish_gulets_for_sale_master-1350.jpg"); z-index: -375;

但是当我用 http 插入时它失败了。 (这段代码适用于我检查过的所有浏览器。)

display: block; background-image: url("http://guletsforsale.org/wp-content/images/2013/02/turkish_gulets_for_sale_master-1350.jpg"); z-index: -375;

什么是解决方案。

问候

最佳答案

你需要使用完整的http路径吗?您可以删除您的来源 ( http://guletsforsale.org ) 并使链接像这样相对:

var origin = window.location.origin;
relativePath = httpPath.replace(origin, "");

所以,现在你有了你应该工作的相对路径。

关于iphone 3/4 背景图像 url 常量路径失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17252508/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com