Im trying to get a swipable tabs to work in a popup, but the tabs are not init when loaded?
So the popup is opened and works as it should and displays the page with the tabs in it, but the tabs are only showing the tab links and the content of tab-1, but it is not init, I can´t change tab by clicking the tab links or swipe between the tabs.
So how do I init the tabs?
This is what I got.
The popup code in my js file:
$$(document).on("click",".tabkategorierna", function(e){
var data;
var datatest;
app.request({
method: 'POST',
url: 'menysidor/tabkategorier.asp',
data: {
userId : 1,
},
success: function (data) {
console.log("tabkategorierna öppnad")
if(data){
var datan=data
tabsPopup(datan);
}
}
});
});
var data;
function tabsPopup(datan){
var datan=String(datan)
var tabsPopup = app.popup.create({
closeByBackdropClick: true,
swipeToClose: true,
backdrop : false,
closeOnEscape : true,
swipeHandler: '.min-swipe-to-close-handler',
content: '<div class="popup" style="background:transparent;">'+
datan +
'</div>',
// Events
on: {
open: function (popup) {
//console.log('Popup open');
},
opened: function (popup) {
//console.log('Popup opened');
},
close: function (popup) {
animate: false;
//console.log('Popup close');
},
}
});
tabsPopup.open();
}
And the page that I load in the popup with the tabs.
<div class="page">
<div class="toolbar tabbar toolbar-top">
<div class="toolbar-inner">
<a href="#tab-1" class="tab-link tab-link-active">Tab 1</a>
<a href="#tab-2" class="tab-link">Tab 2</a>
<a href="#tab-3" class="tab-link">Tab 3</a>
</div>
</div>
<div class="tabs-swipeable-wrap">
<div class="tabs">
<div id="tab-1" class="page-content tab tab-active">
<div class="block">
<p>Tab 1 content</p>
...
</div>
</div>
<div id="tab-2" class="page-content tab">
<div class="block">
<p>Tab 2 content</p>
...
</div>
</div>
<div id="tab-3" class="page-content tab">
<div class="block">
<p>Tab 3 content</p>
...
</div>
</div>
</div>
</div>
</div>
Any input appreciated, thanks.
I hope u see this Vladimir, since Im sure you know what to do