jssor / slider

Touch swipe image slider/slideshow/gallery/carousel/banner mobile responsive bootstrap

Home Page:https://www.jssor.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why does jssor issue a page request for every slide?

digitalprecision opened this issue · comments

I was debugging an issue and noticed that if a page was initializing a jssor slider, that a request was being made to the same page again. I thought it was something in my code, but then realized it's jssor issuing subsequent page requests.

Is there a way to disable requests to the page? jssor should only be issuing requests for the image.

For the new code I opted to download and use v27.0.1 (latest at the time). I was curious if the issue was happening with the old version we were using (before the new code), so I tried v20.0.0 and the multiple page request issue is no longer occurring. I will work my way down and see when the issue was introduced.

Ok, I found that older versions up to 21.1.5 will try to request a null image vs reloading the page again. Weird right? Well the issue is because I was trying to remove the src and data-src2 attributes for the first image of the slider so jquery.lazy could lazy load images as they appear in the viewport via data-src attribute. So the temp fix is leave the data-src2 as is and suffer the loading of all the first slider images (typically multiple sliders per page).

It would be cool if you could add a fix to not do anything if src and data-src2 weren't available or some type of viewport detection algorithm. Thanks.

commented

I see. Thank you!

I found that version > 21.1.5 will issue a request to the page hosting the slider if there is no src attribute (all slider images should be set to data-src2 for lazyloading). So until this issue is resolved I had to downgrade from 27.0.1. Thanks.

commented

This problem has been fixed. Please check the latest version.

EPIC! I'll check it out this week and report back.