简体   繁体   中英

Images don't load on safari

The site works fine on all other browsers, but yesterday on safari the images stoped loading. Most of them were blurry and some didnt load at all. The blurry ones started loading by removing the params from the image but the ones that didn't load at all i can't figure out why. They all have data-src-square.

Code:

    <div class="card__image"
    data-src-square="<?php echo esc_url( $square_featured_image['urlTemplate'] ); ?>"
    data-src="<?php echo esc_url( $featured_image['urlTemplate'] ); ?>"
    style="background-image:url(<?php echo esc_url( $featured_image['urlTemplate_small'] ); ?>"
    alt="<?php echo $featured_image['alt']; ?>)">
    </div>

And on the safari browser if i inspect the html it has an empty " " which doesn't happen on the other browsers:

任何想法我如何解决这个问题/为什么会这样?

The background-image image url is missing ) in the end. It seems safari is more strict.

style="background-image:url(<?php echo esc_url( $featured_image['urlTemplate_small'] ); ?>)"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM