I understand it has to do with the timing of the library loading and the function running at the wrong time or due to the accordion being empty I believe from my research, but I have not been able to find a working way to rewrite this code to work. Any suggestions or workarounds for this?"Uncaught Error: cannot call methods on accordion prior to initialization; attempted to call method 'destroy'"
The JS from the themes product.php
Code: Select all
jQuery( function($) {
function set_product_info() {
var w = $("html").width();
if (w < 768) {
$(".s_tabs").tbTabs("destroy");
$(".s_tab_box").accordion ({
autoHeight: false,
collapsible: true,
active: false
});
}
else {
$(".s_tab_box").accordion("destroy");
$(".s_tabs").tbTabs({ fx: { opacity: 'toggle', duration: 300 } });
}
}