Giter Site home page Giter Site logo

Comments (9)

tkahn avatar tkahn commented on June 20, 2024

Hi!

I haven't tried using Smooth Div Scroll together with LazyLoad, but I am familiar with the plugin. Just from the top of my head, I think there can be problems due to the fact that Smooth Div Scroll needs to know the total width of all the images/elements inside the scrollable area to work properly. Smooth Div Scroll gets this either by loading all images or looking at the CSS. If you use something like LazyLoad, the problems you are experiencing are probably caused by the fact that Smooth Div Scroll cannot calculate the proper total width of all elements because LazyLoad prevents the browser from loading all elements.

But this is just a theory. You'd have to build a demo page and look at what width Smooth Div Scroll calculates and go from there. Unfortunately I have other issues that are more pressing regarding this plugin. Perhaps you could look into this and report back here?

/Thomas

from smooth-div-scroll.

andrewminton avatar andrewminton commented on June 20, 2024

Hi Thomas, I've been looking into this as well and even if I use the src attribute to mirror the dimensions of the data-original attribute in lazyload, smoothdivscroll does not load images when I scroll. this would be a great feature to incorporate/support so any testing I can do or uncover I'd like to help out and get to a solution. I'll keep digging.

from smooth-div-scroll.

andrewminton avatar andrewminton commented on June 20, 2024

Weirdly when I trigger a resize of the browser in an area of the scroll that won't load the data-original attributes.. the event is triggered and the images are replaced.

from smooth-div-scroll.

andrewminton avatar andrewminton commented on June 20, 2024

what if a call back was created for when scrolling has stopped, not just autoScrollingStopped? this could then allow us to trigger the lazyload when the callback has finished maybe? thoughts?

from smooth-div-scroll.

andrewminton avatar andrewminton commented on June 20, 2024

I'm not sure if I've resolved this but by binding to the mousewheel event, I've managed to lazyload the elements I think:
$('#project').bind('mousewheel', function(event, delta, deltaX, deltaY) {
// console.log(delta, deltaX, deltaY);
$("img.lazy").lazyload({container: $("#project")});
});

from smooth-div-scroll.

tkahn avatar tkahn commented on June 20, 2024

A "scrolling has stopped" callback is an interesting idea! I say this without having looked into the specific details of how it would be implemented. In Issue #38 there's a similar discussion going on, but it has to do with getting the auto scrolling status from the plugin.

from smooth-div-scroll.

andrewminton avatar andrewminton commented on June 20, 2024

Kinetic Library has the Stopped Listener which you have already used in the touchscrolling method. Could be some useful code there to factor in. I'm trying to trigger a swap out of content in a div based on the offset.left position of the series of images in the smooth div scroll. Having access to the stopped callback would allow a redraw type function where it triggers a check on offset.left and allows me to calculate what description text I need to populate the div with.

I have the swap out method of text working with a bind to the mousewheel function but touchmove or when touch/scroll events have completed would be ace.

from smooth-div-scroll.

andrewminton avatar andrewminton commented on June 20, 2024

Also, debounce might be another approach? http://jsfiddle.net/hYsRh/4/ but this is dependant on whether smooth div scroll actually binds to the browsers native scroll method or not, which I'm unsure if it does.

from smooth-div-scroll.

shaekuronen avatar shaekuronen commented on June 20, 2024

found a solution to the lazyload images not having their width correct issue. I was already setting the width attribute on images, bc smoothDivScroll does not seem to check width attr, I get the attr width and set it as inline css width, then init smoothDivScroll as a callback. works, though a little less automagically, as you have to set the width attr

  $(document).ready(function() {

    $('.tw-slider .tw-lazyload').each(function() {

      var the_image = $(this);
          the_width = $(the_image).attr('width');

      $(the_image).css('width', the_width + 'px');

    }, init_smooth_div_scroll() );

    function init_smooth_div_scroll() {

      $('.tw-slider').smoothDivScroll({
        autoScrollingMode: "",
        autoScrollingDirection: "endlessLoopRight",
        touchScrolling: true
      });

    }

  });

from smooth-div-scroll.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.