CSS3/ Infinite vertical scrolling carousel with variable width child elements The Next CEO of Stack OverflowInfinite vertical scroll div elementPercentage width child element in absolutely positioned parent on Internet Explorer 7How to Check if element is visible after scrolling?How do I scroll to an element within an overflowed Div?prototype: keep an element in view upon scrollingHow do I combine a background-image and CSS3 gradient on the same element?jQuery scroll to elementHTML table with 100% width, with vertical scroll inside tbodyHow to center an element horizontally and verticallyjQuery smooth scrolling on single page siteHow should I force an element to remain fixed with parallax scrolling?

Which acid/base does a strong base/acid react when added to a buffer solution?

Does the Idaho Potato Commission associate potato skins with healthy eating?

Why did early computer designers eschew integers?

Gauss' Posthumous Publications?

MT "will strike" & LXX "will watch carefully" (Gen 3:15)?

Does Germany produce more waste than the US?

Planeswalker Ability and Death Timing

How to unfasten electrical subpanel attached with ramset

Free fall ellipse or parabola?

How to find if SQL server backup is encrypted with TDE without restoring the backup

How can I separate the number from the unit in argument?

Raspberry pi 3 B with Ubuntu 18.04 server arm64: what pi version

How to pronounce fünf in 45

Mathematica command that allows it to read my intentions

Is a distribution that is normal, but highly skewed, considered Gaussian?

Why was Sir Cadogan fired?

Strange use of "whether ... than ..." in official text

Masking layers by a vector polygon layer in QGIS

What difference does it make matching a word with/without a trailing whitespace?

Calculate the Mean mean of two numbers

Salesforce opportunity stages

Avoiding the "not like other girls" trope?

How exploitable/balanced is this homebrew spell: Spell Permanency?

Could you use a laser beam as a modulated carrier wave for radio signal?



CSS3/ Infinite vertical scrolling carousel with variable width child elements



The Next CEO of Stack OverflowInfinite vertical scroll div elementPercentage width child element in absolutely positioned parent on Internet Explorer 7How to Check if element is visible after scrolling?How do I scroll to an element within an overflowed Div?prototype: keep an element in view upon scrollingHow do I combine a background-image and CSS3 gradient on the same element?jQuery scroll to elementHTML table with 100% width, with vertical scroll inside tbodyHow to center an element horizontally and verticallyjQuery smooth scrolling on single page siteHow should I force an element to remain fixed with parallax scrolling?










0















Piggybacking off this question and excellent answer I have something that needs more work. I have a similar scrolling need, but with child divs and not list elements, and importantly the divs contain images that are all the same width but variable height. Using the animate/scrolltop I cannot get smooth scrolling.



Essentially, I want behavior like in this codepen but with variable height, like in this codepen (which isn't working), because the height of the child element doesn't allow the animate scrollTop to accurately compute:



setInterval(function()
var first_height = $('#list').find('div:first').height(); $('#list').stop().animate(scrollTop:first_height,2650,'linear',function()
$(this).scrollTop(0).find('div:last').after($('div:first', this));
);
, 2700);


Can anyone offer any tips?



EDIT: almost there with this pen based on the answer below. I get "snapping to grid" functionality instead of smooth scrolling.










share|improve this question




























    0















    Piggybacking off this question and excellent answer I have something that needs more work. I have a similar scrolling need, but with child divs and not list elements, and importantly the divs contain images that are all the same width but variable height. Using the animate/scrolltop I cannot get smooth scrolling.



    Essentially, I want behavior like in this codepen but with variable height, like in this codepen (which isn't working), because the height of the child element doesn't allow the animate scrollTop to accurately compute:



    setInterval(function()
    var first_height = $('#list').find('div:first').height(); $('#list').stop().animate(scrollTop:first_height,2650,'linear',function()
    $(this).scrollTop(0).find('div:last').after($('div:first', this));
    );
    , 2700);


    Can anyone offer any tips?



    EDIT: almost there with this pen based on the answer below. I get "snapping to grid" functionality instead of smooth scrolling.










    share|improve this question


























      0












      0








      0








      Piggybacking off this question and excellent answer I have something that needs more work. I have a similar scrolling need, but with child divs and not list elements, and importantly the divs contain images that are all the same width but variable height. Using the animate/scrolltop I cannot get smooth scrolling.



      Essentially, I want behavior like in this codepen but with variable height, like in this codepen (which isn't working), because the height of the child element doesn't allow the animate scrollTop to accurately compute:



      setInterval(function()
      var first_height = $('#list').find('div:first').height(); $('#list').stop().animate(scrollTop:first_height,2650,'linear',function()
      $(this).scrollTop(0).find('div:last').after($('div:first', this));
      );
      , 2700);


      Can anyone offer any tips?



      EDIT: almost there with this pen based on the answer below. I get "snapping to grid" functionality instead of smooth scrolling.










      share|improve this question
















      Piggybacking off this question and excellent answer I have something that needs more work. I have a similar scrolling need, but with child divs and not list elements, and importantly the divs contain images that are all the same width but variable height. Using the animate/scrolltop I cannot get smooth scrolling.



      Essentially, I want behavior like in this codepen but with variable height, like in this codepen (which isn't working), because the height of the child element doesn't allow the animate scrollTop to accurately compute:



      setInterval(function()
      var first_height = $('#list').find('div:first').height(); $('#list').stop().animate(scrollTop:first_height,2650,'linear',function()
      $(this).scrollTop(0).find('div:last').after($('div:first', this));
      );
      , 2700);


      Can anyone offer any tips?



      EDIT: almost there with this pen based on the answer below. I get "snapping to grid" functionality instead of smooth scrolling.







      jquery css3 css-transitions carousel






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 at 13:22







      dama_do_bling

















      asked Mar 7 at 19:17









      dama_do_blingdama_do_bling

      129315




      129315






















          1 Answer
          1






          active

          oldest

          votes


















          0














          It is because you have set a fixed height in your CSS but you didn't include the paddings and margins measurement into your total height of the div you want to set scrollTop animation.





          In order to achieve precise measurement of every elements in the container, we need to get the actual paddings and margins of the element using jQuery.css().




          TAKE NOTE




          CSS shorthand properties are not supported by the jQuery.css() function. So we need to define everything in the traditional way (LMAO).



          Use of parseInt() is necessary as the results of jQuery functions are returned as characters/string, making it concatenate the two results instead of adding them.




          Example: parseInt($('#list').find('div:first').css('padding-top')) + parseInt($('#list').find('div:first').css('padding-bottom'));



          will result in [10 + 10 = 20]



          and $('#list').find('div:first').css('padding-top') + $('#list').find('div:first').css('padding-bottom');



          will result in ['10' + '10' = '1010']







          var interval = 1000;
          setInterval(function()
          var first_height = $('#list').find('div:first').height();
          var paddings = parseInt($('#list').find('div:first').css('padding-top')) + parseInt($('#list').find('div:first').css('padding-bottom'));
          var margins = parseInt($('#list').find('div:first').css('margin-top')) + parseInt($('#list').find('div:first').css('margin-bottom'));
          var animation = interval - paddings - margins;
          $('#list').stop().animate(
          scrollTop: first_height + paddings + margins
          , animation, 'linear', function()
          $(this).scrollTop(0).find('div:last').after($('div:first', this));
          );
          , interval);

          * 
          box-sizing: border-box;


          #list
          overflow: hidden;
          width: 300px;
          height: 250px;
          background: red;
          padding: 10px;


          #list div
          display: block;
          padding: 10px 10px;
          margin-bottom: 10px;
          background: yellow;

          <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
          <div id="list">
          <div style="height: 30px;">Item 1</div>
          <div style="height: 50px;">Item 2</div>
          <div style="height: 30px;">Item 3</div>
          <div style="height: 50px;">Item 4</div>
          <div style="height: 30px;">Item 5</div>
          <div style="height: 50px;">Item 6</div>
          <div style="height: 30px;">Item 7</div>
          <div style="height: 50px;">Item 8</div>
          <div style="height: 30px;">Item 9</div>
          <div style="height: 50px;">Item 10</div>
          </div>






          Source: jQuery API | .css(), jQuery API | .animate()







          share|improve this answer

























          • Super helpful, almost there!! I updated this snippet - jsfiddle.net/8ozx09ca (also in my original answer) but there's still a "hiccup" in the scrolling, how do I make it super smooth - I tried playing with the setInterval value and the animate and it kept snapping the top of each item to the top.. I want a real smooth scrolling. Thank you.

            – dama_do_bling
            Mar 8 at 13:13












          • Also, if I wanted to switch the direction, would it be as straightforward as a negative scrollTop of the same value or something else? Thanks again.

            – dama_do_bling
            Mar 8 at 13:22











          • Updated the answer. However, transitions are smooth but animations are not equal. You may need more complex conditions in order to achieve even transitions on different HTML Element dimensions.

            – The Terrible Child
            Mar 9 at 1:29











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55051291%2fcss3-infinite-vertical-scrolling-carousel-with-variable-width-child-elements%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          It is because you have set a fixed height in your CSS but you didn't include the paddings and margins measurement into your total height of the div you want to set scrollTop animation.





          In order to achieve precise measurement of every elements in the container, we need to get the actual paddings and margins of the element using jQuery.css().




          TAKE NOTE




          CSS shorthand properties are not supported by the jQuery.css() function. So we need to define everything in the traditional way (LMAO).



          Use of parseInt() is necessary as the results of jQuery functions are returned as characters/string, making it concatenate the two results instead of adding them.




          Example: parseInt($('#list').find('div:first').css('padding-top')) + parseInt($('#list').find('div:first').css('padding-bottom'));



          will result in [10 + 10 = 20]



          and $('#list').find('div:first').css('padding-top') + $('#list').find('div:first').css('padding-bottom');



          will result in ['10' + '10' = '1010']







          var interval = 1000;
          setInterval(function()
          var first_height = $('#list').find('div:first').height();
          var paddings = parseInt($('#list').find('div:first').css('padding-top')) + parseInt($('#list').find('div:first').css('padding-bottom'));
          var margins = parseInt($('#list').find('div:first').css('margin-top')) + parseInt($('#list').find('div:first').css('margin-bottom'));
          var animation = interval - paddings - margins;
          $('#list').stop().animate(
          scrollTop: first_height + paddings + margins
          , animation, 'linear', function()
          $(this).scrollTop(0).find('div:last').after($('div:first', this));
          );
          , interval);

          * 
          box-sizing: border-box;


          #list
          overflow: hidden;
          width: 300px;
          height: 250px;
          background: red;
          padding: 10px;


          #list div
          display: block;
          padding: 10px 10px;
          margin-bottom: 10px;
          background: yellow;

          <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
          <div id="list">
          <div style="height: 30px;">Item 1</div>
          <div style="height: 50px;">Item 2</div>
          <div style="height: 30px;">Item 3</div>
          <div style="height: 50px;">Item 4</div>
          <div style="height: 30px;">Item 5</div>
          <div style="height: 50px;">Item 6</div>
          <div style="height: 30px;">Item 7</div>
          <div style="height: 50px;">Item 8</div>
          <div style="height: 30px;">Item 9</div>
          <div style="height: 50px;">Item 10</div>
          </div>






          Source: jQuery API | .css(), jQuery API | .animate()







          share|improve this answer

























          • Super helpful, almost there!! I updated this snippet - jsfiddle.net/8ozx09ca (also in my original answer) but there's still a "hiccup" in the scrolling, how do I make it super smooth - I tried playing with the setInterval value and the animate and it kept snapping the top of each item to the top.. I want a real smooth scrolling. Thank you.

            – dama_do_bling
            Mar 8 at 13:13












          • Also, if I wanted to switch the direction, would it be as straightforward as a negative scrollTop of the same value or something else? Thanks again.

            – dama_do_bling
            Mar 8 at 13:22











          • Updated the answer. However, transitions are smooth but animations are not equal. You may need more complex conditions in order to achieve even transitions on different HTML Element dimensions.

            – The Terrible Child
            Mar 9 at 1:29















          0














          It is because you have set a fixed height in your CSS but you didn't include the paddings and margins measurement into your total height of the div you want to set scrollTop animation.





          In order to achieve precise measurement of every elements in the container, we need to get the actual paddings and margins of the element using jQuery.css().




          TAKE NOTE




          CSS shorthand properties are not supported by the jQuery.css() function. So we need to define everything in the traditional way (LMAO).



          Use of parseInt() is necessary as the results of jQuery functions are returned as characters/string, making it concatenate the two results instead of adding them.




          Example: parseInt($('#list').find('div:first').css('padding-top')) + parseInt($('#list').find('div:first').css('padding-bottom'));



          will result in [10 + 10 = 20]



          and $('#list').find('div:first').css('padding-top') + $('#list').find('div:first').css('padding-bottom');



          will result in ['10' + '10' = '1010']







          var interval = 1000;
          setInterval(function()
          var first_height = $('#list').find('div:first').height();
          var paddings = parseInt($('#list').find('div:first').css('padding-top')) + parseInt($('#list').find('div:first').css('padding-bottom'));
          var margins = parseInt($('#list').find('div:first').css('margin-top')) + parseInt($('#list').find('div:first').css('margin-bottom'));
          var animation = interval - paddings - margins;
          $('#list').stop().animate(
          scrollTop: first_height + paddings + margins
          , animation, 'linear', function()
          $(this).scrollTop(0).find('div:last').after($('div:first', this));
          );
          , interval);

          * 
          box-sizing: border-box;


          #list
          overflow: hidden;
          width: 300px;
          height: 250px;
          background: red;
          padding: 10px;


          #list div
          display: block;
          padding: 10px 10px;
          margin-bottom: 10px;
          background: yellow;

          <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
          <div id="list">
          <div style="height: 30px;">Item 1</div>
          <div style="height: 50px;">Item 2</div>
          <div style="height: 30px;">Item 3</div>
          <div style="height: 50px;">Item 4</div>
          <div style="height: 30px;">Item 5</div>
          <div style="height: 50px;">Item 6</div>
          <div style="height: 30px;">Item 7</div>
          <div style="height: 50px;">Item 8</div>
          <div style="height: 30px;">Item 9</div>
          <div style="height: 50px;">Item 10</div>
          </div>






          Source: jQuery API | .css(), jQuery API | .animate()







          share|improve this answer

























          • Super helpful, almost there!! I updated this snippet - jsfiddle.net/8ozx09ca (also in my original answer) but there's still a "hiccup" in the scrolling, how do I make it super smooth - I tried playing with the setInterval value and the animate and it kept snapping the top of each item to the top.. I want a real smooth scrolling. Thank you.

            – dama_do_bling
            Mar 8 at 13:13












          • Also, if I wanted to switch the direction, would it be as straightforward as a negative scrollTop of the same value or something else? Thanks again.

            – dama_do_bling
            Mar 8 at 13:22











          • Updated the answer. However, transitions are smooth but animations are not equal. You may need more complex conditions in order to achieve even transitions on different HTML Element dimensions.

            – The Terrible Child
            Mar 9 at 1:29













          0












          0








          0







          It is because you have set a fixed height in your CSS but you didn't include the paddings and margins measurement into your total height of the div you want to set scrollTop animation.





          In order to achieve precise measurement of every elements in the container, we need to get the actual paddings and margins of the element using jQuery.css().




          TAKE NOTE




          CSS shorthand properties are not supported by the jQuery.css() function. So we need to define everything in the traditional way (LMAO).



          Use of parseInt() is necessary as the results of jQuery functions are returned as characters/string, making it concatenate the two results instead of adding them.




          Example: parseInt($('#list').find('div:first').css('padding-top')) + parseInt($('#list').find('div:first').css('padding-bottom'));



          will result in [10 + 10 = 20]



          and $('#list').find('div:first').css('padding-top') + $('#list').find('div:first').css('padding-bottom');



          will result in ['10' + '10' = '1010']







          var interval = 1000;
          setInterval(function()
          var first_height = $('#list').find('div:first').height();
          var paddings = parseInt($('#list').find('div:first').css('padding-top')) + parseInt($('#list').find('div:first').css('padding-bottom'));
          var margins = parseInt($('#list').find('div:first').css('margin-top')) + parseInt($('#list').find('div:first').css('margin-bottom'));
          var animation = interval - paddings - margins;
          $('#list').stop().animate(
          scrollTop: first_height + paddings + margins
          , animation, 'linear', function()
          $(this).scrollTop(0).find('div:last').after($('div:first', this));
          );
          , interval);

          * 
          box-sizing: border-box;


          #list
          overflow: hidden;
          width: 300px;
          height: 250px;
          background: red;
          padding: 10px;


          #list div
          display: block;
          padding: 10px 10px;
          margin-bottom: 10px;
          background: yellow;

          <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
          <div id="list">
          <div style="height: 30px;">Item 1</div>
          <div style="height: 50px;">Item 2</div>
          <div style="height: 30px;">Item 3</div>
          <div style="height: 50px;">Item 4</div>
          <div style="height: 30px;">Item 5</div>
          <div style="height: 50px;">Item 6</div>
          <div style="height: 30px;">Item 7</div>
          <div style="height: 50px;">Item 8</div>
          <div style="height: 30px;">Item 9</div>
          <div style="height: 50px;">Item 10</div>
          </div>






          Source: jQuery API | .css(), jQuery API | .animate()







          share|improve this answer















          It is because you have set a fixed height in your CSS but you didn't include the paddings and margins measurement into your total height of the div you want to set scrollTop animation.





          In order to achieve precise measurement of every elements in the container, we need to get the actual paddings and margins of the element using jQuery.css().




          TAKE NOTE




          CSS shorthand properties are not supported by the jQuery.css() function. So we need to define everything in the traditional way (LMAO).



          Use of parseInt() is necessary as the results of jQuery functions are returned as characters/string, making it concatenate the two results instead of adding them.




          Example: parseInt($('#list').find('div:first').css('padding-top')) + parseInt($('#list').find('div:first').css('padding-bottom'));



          will result in [10 + 10 = 20]



          and $('#list').find('div:first').css('padding-top') + $('#list').find('div:first').css('padding-bottom');



          will result in ['10' + '10' = '1010']







          var interval = 1000;
          setInterval(function()
          var first_height = $('#list').find('div:first').height();
          var paddings = parseInt($('#list').find('div:first').css('padding-top')) + parseInt($('#list').find('div:first').css('padding-bottom'));
          var margins = parseInt($('#list').find('div:first').css('margin-top')) + parseInt($('#list').find('div:first').css('margin-bottom'));
          var animation = interval - paddings - margins;
          $('#list').stop().animate(
          scrollTop: first_height + paddings + margins
          , animation, 'linear', function()
          $(this).scrollTop(0).find('div:last').after($('div:first', this));
          );
          , interval);

          * 
          box-sizing: border-box;


          #list
          overflow: hidden;
          width: 300px;
          height: 250px;
          background: red;
          padding: 10px;


          #list div
          display: block;
          padding: 10px 10px;
          margin-bottom: 10px;
          background: yellow;

          <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
          <div id="list">
          <div style="height: 30px;">Item 1</div>
          <div style="height: 50px;">Item 2</div>
          <div style="height: 30px;">Item 3</div>
          <div style="height: 50px;">Item 4</div>
          <div style="height: 30px;">Item 5</div>
          <div style="height: 50px;">Item 6</div>
          <div style="height: 30px;">Item 7</div>
          <div style="height: 50px;">Item 8</div>
          <div style="height: 30px;">Item 9</div>
          <div style="height: 50px;">Item 10</div>
          </div>






          Source: jQuery API | .css(), jQuery API | .animate()







          var interval = 1000;
          setInterval(function()
          var first_height = $('#list').find('div:first').height();
          var paddings = parseInt($('#list').find('div:first').css('padding-top')) + parseInt($('#list').find('div:first').css('padding-bottom'));
          var margins = parseInt($('#list').find('div:first').css('margin-top')) + parseInt($('#list').find('div:first').css('margin-bottom'));
          var animation = interval - paddings - margins;
          $('#list').stop().animate(
          scrollTop: first_height + paddings + margins
          , animation, 'linear', function()
          $(this).scrollTop(0).find('div:last').after($('div:first', this));
          );
          , interval);

          * 
          box-sizing: border-box;


          #list
          overflow: hidden;
          width: 300px;
          height: 250px;
          background: red;
          padding: 10px;


          #list div
          display: block;
          padding: 10px 10px;
          margin-bottom: 10px;
          background: yellow;

          <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
          <div id="list">
          <div style="height: 30px;">Item 1</div>
          <div style="height: 50px;">Item 2</div>
          <div style="height: 30px;">Item 3</div>
          <div style="height: 50px;">Item 4</div>
          <div style="height: 30px;">Item 5</div>
          <div style="height: 50px;">Item 6</div>
          <div style="height: 30px;">Item 7</div>
          <div style="height: 50px;">Item 8</div>
          <div style="height: 30px;">Item 9</div>
          <div style="height: 50px;">Item 10</div>
          </div>





          var interval = 1000;
          setInterval(function()
          var first_height = $('#list').find('div:first').height();
          var paddings = parseInt($('#list').find('div:first').css('padding-top')) + parseInt($('#list').find('div:first').css('padding-bottom'));
          var margins = parseInt($('#list').find('div:first').css('margin-top')) + parseInt($('#list').find('div:first').css('margin-bottom'));
          var animation = interval - paddings - margins;
          $('#list').stop().animate(
          scrollTop: first_height + paddings + margins
          , animation, 'linear', function()
          $(this).scrollTop(0).find('div:last').after($('div:first', this));
          );
          , interval);

          * 
          box-sizing: border-box;


          #list
          overflow: hidden;
          width: 300px;
          height: 250px;
          background: red;
          padding: 10px;


          #list div
          display: block;
          padding: 10px 10px;
          margin-bottom: 10px;
          background: yellow;

          <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
          <div id="list">
          <div style="height: 30px;">Item 1</div>
          <div style="height: 50px;">Item 2</div>
          <div style="height: 30px;">Item 3</div>
          <div style="height: 50px;">Item 4</div>
          <div style="height: 30px;">Item 5</div>
          <div style="height: 50px;">Item 6</div>
          <div style="height: 30px;">Item 7</div>
          <div style="height: 50px;">Item 8</div>
          <div style="height: 30px;">Item 9</div>
          <div style="height: 50px;">Item 10</div>
          </div>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 9 at 1:27

























          answered Mar 8 at 3:42









          The Terrible ChildThe Terrible Child

          1036




          1036












          • Super helpful, almost there!! I updated this snippet - jsfiddle.net/8ozx09ca (also in my original answer) but there's still a "hiccup" in the scrolling, how do I make it super smooth - I tried playing with the setInterval value and the animate and it kept snapping the top of each item to the top.. I want a real smooth scrolling. Thank you.

            – dama_do_bling
            Mar 8 at 13:13












          • Also, if I wanted to switch the direction, would it be as straightforward as a negative scrollTop of the same value or something else? Thanks again.

            – dama_do_bling
            Mar 8 at 13:22











          • Updated the answer. However, transitions are smooth but animations are not equal. You may need more complex conditions in order to achieve even transitions on different HTML Element dimensions.

            – The Terrible Child
            Mar 9 at 1:29

















          • Super helpful, almost there!! I updated this snippet - jsfiddle.net/8ozx09ca (also in my original answer) but there's still a "hiccup" in the scrolling, how do I make it super smooth - I tried playing with the setInterval value and the animate and it kept snapping the top of each item to the top.. I want a real smooth scrolling. Thank you.

            – dama_do_bling
            Mar 8 at 13:13












          • Also, if I wanted to switch the direction, would it be as straightforward as a negative scrollTop of the same value or something else? Thanks again.

            – dama_do_bling
            Mar 8 at 13:22











          • Updated the answer. However, transitions are smooth but animations are not equal. You may need more complex conditions in order to achieve even transitions on different HTML Element dimensions.

            – The Terrible Child
            Mar 9 at 1:29
















          Super helpful, almost there!! I updated this snippet - jsfiddle.net/8ozx09ca (also in my original answer) but there's still a "hiccup" in the scrolling, how do I make it super smooth - I tried playing with the setInterval value and the animate and it kept snapping the top of each item to the top.. I want a real smooth scrolling. Thank you.

          – dama_do_bling
          Mar 8 at 13:13






          Super helpful, almost there!! I updated this snippet - jsfiddle.net/8ozx09ca (also in my original answer) but there's still a "hiccup" in the scrolling, how do I make it super smooth - I tried playing with the setInterval value and the animate and it kept snapping the top of each item to the top.. I want a real smooth scrolling. Thank you.

          – dama_do_bling
          Mar 8 at 13:13














          Also, if I wanted to switch the direction, would it be as straightforward as a negative scrollTop of the same value or something else? Thanks again.

          – dama_do_bling
          Mar 8 at 13:22





          Also, if I wanted to switch the direction, would it be as straightforward as a negative scrollTop of the same value or something else? Thanks again.

          – dama_do_bling
          Mar 8 at 13:22













          Updated the answer. However, transitions are smooth but animations are not equal. You may need more complex conditions in order to achieve even transitions on different HTML Element dimensions.

          – The Terrible Child
          Mar 9 at 1:29





          Updated the answer. However, transitions are smooth but animations are not equal. You may need more complex conditions in order to achieve even transitions on different HTML Element dimensions.

          – The Terrible Child
          Mar 9 at 1:29



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55051291%2fcss3-infinite-vertical-scrolling-carousel-with-variable-width-child-elements%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

          Алба-Юлія

          Захаров Федір Захарович