Skip to content Skip to sidebar Skip to footer

IScroll 4 Stops Working Because Of Container CSS Created By Javascript JQuery

I'm running iScroll 4 inside a DIV, but the DIV's height is generated dynamically, and screws up iScroll

Solution 1:

have you tried the refresh() method for iScroll?

You do need to change you code a bit because you use the myScroll for multiple elements. So for example if you have 1 element that needs to be iScrolled:

<script type="text/javscript">
  var myScroll;
  function loaded() {
    myScroll = new iScroll('sidebar-wrapper');
  }
  document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
  document.addEventListener('DOMContentLoaded', loaded, false);

  $(function() {
    $("#latest-tweet").tweet({
      count: 1,
      username: ["motocomdigital"],
      loading_text: "searching twitter..."
    }).bind("loaded", function(){
      // as described on the "Methods" section on http://cubiq.org/iscroll
      setTimeout(function () { myScroll.refresh() }, 0);
    });
  });
</script>

Post a Comment for "IScroll 4 Stops Working Because Of Container CSS Created By Javascript JQuery"