【发布时间】:2018-08-26 19:05:01
【问题描述】:
我正在尝试用自定义图像替换网站上的视频图标。我以为我在页脚中有代码并使用了 attr 功能,但我没有得到任何结果。我错过了什么?
该图标位于我的客户网站http://www.sunsetstudiosent.com“电影”部分的 YouTube 视频链接上
还有我目前的代码:
<script>
$(document).ready(function () {
$(".sqs-video-icon").attr("src", "https://static1.squarespace.com/static/50e3caa8e4b0c2f4977139be/t/5aad883e88251b563049bb78/1521322046538/play_icon.png");
});
</script>
它似乎是从 Squarespace 上的库存图片中搜索 url,但我不确定如何让这个更改生效。
.sqs-video-wrapper .sqs-video-overlay .sqs-video-icon {
background-image: url('//static.squarespace.com/universal/images-v6/damask/play-button@2x.png');
background-size: 33px;
}
.sqs-video-wrapper .sqs-video-overlay .sqs-video-icon {
position: absolute;
top: 50%;
left: 50%;
background: transparent url('//static.squarespace.com/universal/images-v6/damask/play-button.png') center center no-repeat;
background-image: url("//static.squarespace.com/universal/images-v6/damask/play-button.png");
background-size: auto auto;
height: 48px;
width: 48px;
margin-left: -24px;
margin-top: -24px;
cursor: pointer;
谢谢。
【问题讨论】:
标签: jquery image replace attributes squarespace