SHARE
TWEET

Untitled

a guest Jun 25th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let _library,
  2.     _categories;
  3.  
  4. getCategories(){
  5.     return _categories;
  6. }
  7.  
  8. loadCategories(){
  9.     let categs = _categories
  10.  
  11.     let htmlElems = "";
  12.       for (var i = 0; i < categs.length; i++) {
  13.            htmlElems += "<div class='cat-box cat-num-" + i + "'data-target='#modal-id' data-toggle='modal'>" + categs[i].Title + "</div>";
  14.            $(".modal-title").eq(i).append(categs[i].Title);
  15.       }
  16.  
  17.      let container = document.querySelector("div.top-training");
  18.      container.innerHTML = htmlElems;
  19.      console.log(container);
  20.  
  21. }
  22.      
  23. $(document).on("click", '.cat-box', function(val) {
  24.     console.log('.cat-box clicked')
  25.     let cat  = $(this).data('category'),
  26.         desc = $(this).find("span").last().text();
  27.  
  28. // irrelevant code
  29.      
  30. <div class="modal" id="modal-id" role="dialog">
  31. <!-- ...etc -->
  32. <div class="modal-title" id="exampleModalLabel"></div>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top