Skip to content

Instantly share code, notes, and snippets.

@NickDeckerDevs
Last active March 29, 2018 13:36
Show Gist options
  • Select an option

  • Save NickDeckerDevs/3854d7d0c63f6c667820a67cc8f7aae5 to your computer and use it in GitHub Desktop.

Select an option

Save NickDeckerDevs/3854d7d0c63f6c667820a67cc8f7aae5 to your computer and use it in GitHub Desktop.
settimeout example to prevent item from happening 1000 times
var timer;
function load_and_resize() {
if($('.diagram-details').length > 0) {
$('.diagram-details .col-md-3').matchHeight({
property: 'min-height'
});
}
if($('.modal-active').length > 0) {
$modal_content = $('.modal-active').find('.modal-content');
adjust_modal_sizing_and_positioning($('.modal-active'), $modal_content);
$modal_content.css('visibility', 'visible');
$('.modal-active').fadeIn();
}
// for about us modal in the future
// if($('#take-over').length > 0) {
// $modal_container = $('#take-over');
// $modal_content = $modal_container.find('.flex-wrap');
// adjust_modal_sizing_and_positioning($modal_container, $modal_content);
// $modal_content.css('visibility', 'visible');
// $modal_container.fadeIn();
// }
// this is preventing the resetting of the sliders to happen 1000 times while the screen is resizing.
// after .6 seconds of load or resize being complete then we fire our activate_slider function
clearTimeout(timer);
timer = setTimeout(function() {
activate_slider();
var diagram_slider_exists = $('.diagram-example.multiple').length;
if(diagram_slider_exists > 0) {
// debugger;
activate_uml_slider();
}
}, 600);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment