search

Home  >  Q&A  >  body text

What to do when iscroll instantiates an unknown number of content blocks?

When there are multiple classes of the same class: What should I do when iscroll instantiates an unknown number of content blocks? What should I do if I only write one instance and only the first content will take effect? ​​Do I need to write a for loop? how to write?

高洛峰高洛峰2754 days ago462

reply all(1)I'll reply

  • 仅有的幸福

    仅有的幸福2017-05-16 13:40:23

    <script>

        var iscroll = document.getElementsByClassName("my-iscroll-wrapper");
        for (var i = 0; i < iscroll.length; i++) {
            var myScroll = new IScroll(iscroll[i], {
                //代码块
            });
        }
    </script>

    reply
    0
  • Cancelreply