intense-images icon indicating copy to clipboard operation
intense-images copied to clipboard

data-src image loading.

Open tholman opened this issue 9 years ago • 9 comments

When loading an image with data-src, there is the potential to have a situation where the image isn't loaded already, which means there is a delay opening the image for viewing... within this delay, clicking around can confuse intense.js into thinking images are open when they aren't.

The fix: Add a small spinner, which will activate when the image isn't fully loaded, and will only really be on the screen while the image loads. Clicking the background while the spinner is open, will cancel the load, and hide intense straight away.

Merging in #7 and #9 into this issue, and closing them off as duplicates, as they are each small parts of the 1 issue.

tholman avatar Jul 09 '14 05:07 tholman

Is this fixed in the current version? I like your Script and I would like to use it on my photo-blog for fullscreen view.

BugHunter2k avatar Sep 28 '14 19:09 BugHunter2k

Same Question and issue.

myconcretelab avatar Dec 22 '14 17:12 myconcretelab

It isn't yet, no :(

tholman avatar Dec 22 '14 17:12 tholman

Is there any plan to fix this? I'm barely above noob level but will have a look at the source. Any tips for where I might look for callbacks, or where I should be adding one in?

benjaminsehl avatar Sep 11 '15 21:09 benjaminsehl

@bsehl this is fixed by adding state classes on the element (https://github.com/myconcretelab/intense-images/commit/c498df1ec7e4f249bd08c48d3de5dbfa954e9484) you are now able to add a spinner onto the images.

Simply add a new css-rule to your stylesheets to get an loading animation, something like: (.intense is the css-class of the image, .loading is added by intense image-script, ::after adds an overlay with the loading.gif)

.intense.loading::after {
  background: rgba(255, 255, 255, 0.8) url("/image/loading.gif") no-repeat scroll center 170px;
  bottom: 0;
  content: "";
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

Demo: http://www.ingosfotoblog.de/2015/09/05/rote-dahlie-bei-uns-am-balkon/ (klick the large image)

BugHunter2k avatar Sep 21 '15 08:09 BugHunter2k

would love to have this fixed as well. will try the loading.gif as a preventive thing.

tiagogon avatar Oct 29 '15 12:10 tiagogon

How about having a callback option for image-load-start and image-load-end?

loader.start() and .stop() could be provied via intense.config({ loader: { start: showMySpinner, stop: hideMySpinner } });

panstav avatar Jun 30 '16 03:06 panstav

Also valid, I changed the way config works slightly. But this'd definitely be the way to go

tholman avatar Jul 02 '16 16:07 tholman

Right, so now it would be possible to attach a loader with both intense( elements, configObj ) AND / OR intense.config( configObj )

panstav avatar Jul 02 '16 18:07 panstav