var Form_Wizard_Tip = { _tipClass: 'wizard-tip', init: function() { var obj = this; var cvvTip = $('.' + obj._tipClass); if (!qs.constant('IS_TOUCHSCREEN')) { $(cvvTip).popover({ trigger: 'manual' , html: true, animation: false}) .on('mouseenter focus', function () { var _this = this; $(this).popover('show'); $('.popover').on('mouseleave blur', function () { $(_this).popover('hide'); }); }).on('mouseleave blur', function () { var _this = this; setTimeout(function () { if (!$('.popover:hover').length) { $(_this).popover('hide'); } }, 1000); }); } else { $(cvvTip).popover({html: true}); var hitEvent = ('ontouchstart' in document.documentElement ? 'touchstart' : 'click') + '.' + obj._tipClass; $('body').on(hitEvent, function (e) { $(cvvTip).each(function () { if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) { $(this).popover('hide'); } }); }); var orientationEvent = 'onorientationchange' in window ? 'orientationchange' : 'resize'; $('body').on(orientationEvent, function () { $(cvvTip).popover('hide'); }); } } };