Lazy-loading tooltips (twitter bootstrap)
A simple way to reduce load time by waiting to load tooltips until they're needed:
$(document).on('mouseover', '.tip', function () {
if ( $(this).data('isTooltipLoaded') == true ) { return; }
$(this).data('isTooltipLoaded', true).tooltip().trigger('mouseover');
});
Example html:
<p>This required a <span class="tip" title="A premium account is...">premium</span> account.</p>Written by Gilbert
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Twitter bootstrap
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#