I have a question regarding the use of Zurb Foundation 6 Tabs and some JavaScript functionality. Below is the HTML code for a layout with 3 tabs:
<ul class="tabs" data-tabs id="myTabs">
<li class="tabs-title is-active"><a href="#panel1" aria-selected="true">Tab 1 Info</a></li>
<li class="tabs-title"><a href="#panel2">Tab 2 Info</a></li>
<li class="tabs-title"><a href="#panel3">Tab 3 Info</a></li>
</ul>
<div class="tabs-content" data-tabs-content="myTabs">
<div class="tabs-panel is-active" id="panel1">
....
</div>
<div class="tabs-panel" id="panel2">
....
</div>
<div class="tabs-panel" id="panel3">
....
</div>
</div>
The tabs are functioning correctly, but I want to dynamically load content into Tab 3 only when it is clicked. I plan to use ajax for this purpose. The Zurb Foundation 6 documentation provides a JavaScript event that triggers whenever any tab is clicked:
$('#myTabs').on('change.zf.tabs', function() {
console.log('Those tabs sure did change!');
});
However, I need an event to trigger only when panel3 is selected. How can I achieve this?