这是我到目前为止尝试过的。有没有办法可以用 srcset 替换图像中的尺寸?我无权访问这些图像。我能够拉伸它但仍然拉出 182px src。我能做的任何帮助或建议将不胜感激。我尝试手动将其添加到 css 以在 mediaquery 上调用图像。
$(document).ready(function(){
$("img.lida4py_thumb").attr("sizes", "(max-width: 46em) 95vw, 400px");
});
<script src="https://code.jquery.com/jquery-3.6.3.js"></script>
<img src="https://t.realgeeks.media/thumbnail/jSuepaS-XalkB5BqfMOOfFAhGdM=/182x144/property-media.realgeeks.com/275/98cb99236a6024ce1cc7e0f56a6bc86b.jpg"
srcset="https://t.realgeeks.media/thumbnail/jSuepaS-XalkB5BqfMOOfFAhGdM=/182x144/property-media.realgeeks.com/275/98cb99236a6024ce1cc7e0f56a6bc86b.jpg 182w, https://t.realgeeks.media/thumbnail/gLfEhCIPUs0I_GG10Vmm_GGxftE=/trim:top-left:15/fit-in/400x0/property-media.realgeeks.com/275/98cb99236a6024ce1cc7e0f56a6bc86b.jpg 400w" class="lida4py_thumb" sizes="(max-width: 46em) 95vw, 182px" alt="3468 Harville Road, Hydesville image">
$(document).ready(function(){
$("img.lida4py_thumb").attr("sizes", "(max-width: 46em) 95vw, 400px");
$("img.lida4py_thumb").attr("srcset", $("img.lida4py_thumb").attr("srcset").replace("182w", ""));
});
<script src="https://code.jquery.com/jquery-3.6.3.js"></script>
<img src="https://t.realgeeks.media/thumbnail/jSuepaS-XalkB5BqfMOOfFAhGdM=/182x144/property-media.realgeeks.com/275/98cb99236a6024ce1cc7e0f56a6bc86b.jpg"
srcset="https://t.realgeeks.media/thumbnail/jSuepaS-XalkB5BqfMOOfFAhGdM=/182x144/property-media.realgeeks.com/275/98cb99236a6024ce1cc7e0f56a6bc86b.jpg 182w, https://t.realgeeks.media/thumbnail/gLfEhCIPUs0I_GG10Vmm_GGxftE=/trim:top-left:15/fit-in/400x0/property-media.realgeeks.com/275/98cb99236a6024ce1cc7e0f56a6bc86b.jpg 400w" class="lida4py_thumb" sizes="(max-width: 46em) 95vw, 182px" alt="3468 Harville Road, Hydesville image">