Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load background images after dom #44

Open
Deam94 opened this issue Jul 2, 2019 · 0 comments
Open

Load background images after dom #44

Deam94 opened this issue Jul 2, 2019 · 0 comments

Comments

@Deam94
Copy link

Deam94 commented Jul 2, 2019

Is there any way to load the "small images" - background images after the dom is load ?
The problem here is i cant use something like lazyload on it and a large number of images end up in slow page load.

Something like:
<a href="images/1.jpg"><img src="images/1_tb.jpg" alt=""></a>
->
<a href="images/1.jpg"><img data-src="images/1_tb.jpg" alt=""></a>

~

var thumb = $('img', this).attr('src')
firstThumb = $('img', this)[0].src

->

var thumb = $('img', this).data('src')
firstThumb = $('img', this).data('src')

...

You can use
$(document).ready(function(){
instead of
$(window).on('load', function() {
then

@Deam94 Deam94 changed the title Load background images after dom$(window).on('load', function() { Load background images after dom Jul 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant