Skip to content
New issue

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

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

Already on GitHub? # to your account

added check for img visibility #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kevcenteno
Copy link

Here's a sketch in jQuery for checking visibility.

Use case: The image is in a div that is toggled (ie click to show image).

<a id="toggle">toggle</a>
<div id="hidden-img" style="display: none">
  <img class="lazyload" data-src="some-image.jpg" />
</div>

<script>
var lazy = new Riloadr(
  name: 'lazyload',
  defer: {mode: 'invisible'},
  breakpoints: [{name: 'all', minWidth: 0}]
);

$('#toggle').click(function (e) {
  $('#hidden-img').toggle();
  lazy.riload();
}
</script>

@kevcenteno
Copy link
Author

@tubalmartin Does this look reasonable?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant