Skip to content

Instantly share code, notes, and snippets.

@bigdigital
Last active Apr 23, 2018
Embed
What would you like to do?
The7 Fix for messed content in tabs, accordion and toogle elements
jQuery(document).ready(function($) {
setTimeout(function(){
$(window).trigger('resize');
}, 500);
function dtResize() {
var elements = [];
elements['accord']= jQuery(".wpb_accordion_header"),
elements['ult_tab'] = $(".ult_tabs > ul >li"),
elements['theme_tab'] = $(".wpb_tour_tabs_wrapper > ul >li"),
elements['togg'] = $(".wpb_toggle");
function resizeme() {
$(window).trigger('resize');
if (typeof google !== 'undefined') google.maps.event.trigger(map, 'resize');
//add "class="gmaps" class to the google maps iframe to get properly scaled map int the tab see https://www.screencast.com/t/RtkfYhgoydXV
jQuery( '.gmaps' ).find('iframe').attr( 'src', function ( i, val ) { return val; });
};
for (var key in elements) {
if (elements[key].length) {
resizeme();
elements[key].on("click",function() {
resizeme();
});
}
}
}
dtResize();});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment