Skip to content
This repository was archived by the owner on Jan 7, 2026. It is now read-only.
This repository was archived by the owner on Jan 7, 2026. It is now read-only.

scrollable not working for dynamically inserted list item from Javascript #5

Description

@itree

Scrollable list works when the list is a static list. However, if the <li> is dynamically inserted into the <ul> in tt.EVENTS.PAGE_START the list won't scroll beyond the last item of the statically created list.

Below are the example js code and html. Please let us know how to make dynamically generated list scrollable. Thanks.

tt.on(tt.EVENTS.PAGE_START, 'home', function() {
  console.log("I'm on the home page!");

  for(var i = 0; i<=100; i++){
    console.log(i);
    var li = document.createElement('li')
    li.innerHTML = i + ' akdsfj kadsfj';
    li.setAttribute(
      'class',
      'topcoat-list__item'
    )
    li.setAttribute(
      'data-rel',
      'buttonExample'
    )

    var span = document.createElement('span')
    span.setAttribute(
      'class',
      'chevron'
    )
    li.appendChild(span);
    $('#demoList').append(li)
  }

});
<div class="content scrollable" data-scroll-x="false" data-scroll-y="true"> <!-- containers with the class scrollable are automatically hooked into iscroll -->

        <div class="topcoat-list__container">
            <ul id="demoList" class="topcoat-list list">
                 <li class="topcoat-list__item" data-rel="buttonExample">
                    <span class="formItem">Buttons</span><span class="chevron"></span><span class="count"></span>
                </li>


           </ul>
</div>
</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions