Advertisement
joris

Adding Element

Sep 7th, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function addListItem() {
  2.     var listItem, container, dataList = document.getElementById('dataList');
  3.  
  4.     // Create our list item
  5.     listItem = document.createElement('div');
  6.     listItem.setAttribute('data-bb-type', 'item');
  7.     listItem.setAttribute('data-bb-img', 'images/icons/icon11.png');
  8.     listItem.setAttribute('data-bb-title', 'Title ');
  9.     listItem.innerHTML = 'My description';
  10.  
  11.     // Create a dummy container
  12.     container = document.createElement('div');
  13.     container.appendChild(listItem);
  14.  
  15.     // Apply the styling
  16.     bb.imageList.apply([container]);
  17.  
  18.     // Append the item
  19.     dataList.appendChild(container.firstChild);
  20.  
  21.     // re-compute the scrolling area
  22.     if (bb.scroller) {
  23.         bb.scroller.refresh();
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement