Advertisement
DataCCIW

Rock Store Featured Promos Lava Template

Jul 28th, 2022 (edited)
1,531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {%- comment -%}
  2.    Last Update: 7-28-22
  3.    Summary: Adds search functionality to the Rock Store PromoList.lava lava template
  4. {%- endcomment -%}
  5.  
  6. {%- javascript -%}
  7. $(document).ready(function()
  8. {
  9.     // Prevent async page submission triggered by enter key which breaks script, preventing submission after keyup does not work
  10.     $('#pageSearch').on('keydown', function(e)
  11.     {
  12.  
  13.         if (e.keyCode == 13)
  14.         {
  15.             e.preventDefault();
  16.             return false;
  17.         }
  18.     });
  19.  
  20.     // Filter plugin links when Search box is updated, value of text is not updated until after keyup
  21.     $('#pageSearch').on('keyup', function(e)
  22.     {
  23.         var value = $(this).val().toLowerCase();
  24.         $('.panel-body div.row div.col-lg-3').filter(function()
  25.         {
  26.             $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
  27.         });
  28.     });
  29. });
  30. {%- endjavascript -%}
  31.  
  32. {%- stylesheet -%}
  33.     #pageSearch { margin-bottom:15px; }
  34. {%- endstylesheet -%}
  35.  
  36. <div class="form-inline">
  37.     <div class="form-group">
  38.         <input id="pageSearch" type="text" class="form-control input-sm" placeholder="Search&hellip;">
  39.     </div>
  40. </div>
  41.  
  42. {% include '~/Assets/Lava/Store/PromoList.lava' %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement