ryanve / response.js

Responsive design toolkit
http://responsejs.com
Other
801 stars 123 forks source link

Trigger DOM update on click #31

Closed jlevinsohn31 closed 11 years ago

jlevinsohn31 commented 11 years ago

Not an issue just a question from a first timer.

I'm using lazy: true and having some difficulty. Some of my imgs are hidden until another object is clicked. The hidden images are not getting a src until I scroll (just a 1px scroll gets it to update). As I continue to click, each img needs a scroll to show. Any ideas?

Can I trigger an update on click? Maybe there's an option to give an offset to the lazy load so the js knows to trigger 200px (or whatever) before the particular img is in view?

Thanks for any help.

ryanve commented 11 years ago

For now (0.7) try something like this to trigger the update.

jQuery(document).ready(function($) {
    $('#control').click(function() {
        $(window).trigger('resize.Response');
    });
});

Triggerable events in 0.7—these may change in future versions:

500px cushion is used. Include a verge amount like {"lazy":true, "verge":1000} to customize this.

jlevinsohn31 commented 11 years ago

This is great. Both bits of advice are working for me. Much appreciated!