Skip to content

Instantly share code, notes, and snippets.

@bigdigital
Last active April 23, 2018 06:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bigdigital/6b36860227a54664311e545f2f5e30c4 to your computer and use it in GitHub Desktop.
Save bigdigital/6b36860227a54664311e545f2f5e30c4 to your computer and use it in GitHub Desktop.
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