Don't load hidden images

前端 未结 7 1165
旧时难觅i
旧时难觅i 2020-12-02 13:19

I have a bunch of hidden images on my website. Their container DIVs have style=\"display: none\". Depending on the user\'s actions, some images may be revealed via javascrip

7条回答
  •  青春惊慌失措
    2020-12-02 13:58

    Using CSS to put the image an unused class, then adding that class to an element with javascript is going to be your best bet. If you don't use image tags at all, this solution becomes a bit more obvious.

    Though, for perspective, most people have the opposite problem where they want to preload an image so it shows up instantly when it's told to be shown.

提交回复
热议问题