Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {%- comment -%}
- Last Update: 1-6-22
- Summary: Adds search functionality to the PageListAsBlocks lava template
- {%- endcomment -%}
- {%- javascript -%}
- $(document).ready(function()
- {
- // Prevent async page submission triggered by enter key which breaks script, preventing submission after keyup does not work
- $('#pageSearch').on('keydown', function(e)
- {
- if (e.keyCode == 13)
- {
- e.preventDefault();
- return false;
- }
- });
- // Filter page links when Search box is updated, value of text is not updated until after keyup
- $('#pageSearch').on('keyup', function(e)
- {
- var value = $(this).val().toLowerCase();
- $('.panel-body ul li').filter(function()
- {
- $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
- });
- });
- });
- {%- endjavascript -%}
- {%- stylesheet -%}
- #pageSearch { margin-bottom:15px; }
- {%- endstylesheet -%}
- <div class="form-inline">
- <div class="form-group">
- <input id="pageSearch" type="text" class="form-control input-sm" placeholder="Search…">
- </div>
- </div>
- {%- include '~~/Assets/Lava/PageListAsBlocks.lava' -%}
Add Comment
Please, Sign In to add comment