@@ -7,56 +7,45 @@ title : 'Test Page'
77type : 'Library'
88---
99<div class="ui container">
10- <div class="ui basic segment">
11- 1. After "First" tab is clicked, click the "ClickMe" button. Alert will appear<br />
12- 2. <b>BUG:</b> When "First" tab is clicked on again, button stops working. Changing <i>cacheType</i> doesnt change anything!<br />
13- 3. <b>The goal is to run JS once and then leave it be</b>. So scripts must be evaluated once and tab should not reload, if focused on again.
14- </div>
15-
16- <div class="ui top attached tabular menu">
17- <a class="active item" data-tab="first">First</a>
18- <a class="item" data-tab="second">Second</a>
19- </div>
20- <div class="ui bottom attached active tab segment" data-tab="first">
21-
22- </div>
23- <div class="ui bottom attached tab segment" data-tab="second">
24-
10+ <div id="first" class="ui search">
11+ <div class="ui left icon input">
12+ <input class="prompt" type="text" placeholder="Search countries">
13+ <i class="icon"></i>
14+ </div>
2515</div>
2616</div>
2717<script>
2818$(document).ready(function() {
29- var firstTabContent = "<div id='testfirst'>One <button>ClickMe</button></div> \n" +
30- "<script type='text/javascript'>\n" +
31- " $(function() { $('button').click(function() { alert(1) }); $('#testfirst').append('<div>dynamically appended div <b>(will disappear if tab is clicked again!)</b> ' + (new Date()).getTime() + '</div>') });\n" +
32- "</scr" + "ipt>";
33-
34- $('.menu .item')
35- .tab({
36- cache: true,
37- cacheType: 'DOM',
38- evaluateScripts: true,
39- onFirstLoad: function(tabPath, parameterArray, historyEvent) {
40- console.log('Initialized tab: ' + tabPath);
41- },
42- onLoad: function(tabPath, parameterArray, historyEvent) { //tab selected
43- console.log('Selected tab: ' + tabPath);
44- },
45- apiSettings: {
46- loadingDuration : 300,
47- mockResponse : function(settings) {
48- var response = {
49- first : firstTabContent,
19+ var content = [
20+ { title: 'Andorra' },
21+ { title: 'United Arab Emirates' },
22+ { title: 'Afghanistan' },
23+ { title: 'Antigua' },
24+ { title: 'Anguilla' },
25+ { title: 'Albania' },
26+ { title: 'Armenia' },
27+ { title: 'Netherlands Antilles' },
28+ { title: 'Angola' },
29+ { title: 'Argentina' },
30+ { title: 'American Samoa' },
31+ { title: 'Austria' },
32+ { title: 'Australia' },
33+ { title: 'Aruba' },
34+ { title: 'Aland Islands' },
35+ { title: 'Azerbaijan' },
36+ { title: 'Bosnia' },
37+ { title: 'Barbados' },
38+ { title: 'Bangladesh' },
39+ { title: 'Belgium' },
40+ { title: 'Burkina Faso' },
41+ { title: 'Bulgaria' },
42+ { title: 'Bahrain' },
43+ { title: 'Burundi' }
44+ // etc
45+ ];
46+ $('#first').search({source: content ,showNoResults: false});
5047
51- second : 'Two',
5248
53- third : 'Three'
54- };
55-
56- return response[settings.urlData.tab];
57- }
58- }
59- });
6049});
6150
6251</script>
0 commit comments