| 1 |
|
| 2 |
// FixIn: 10.2.0.4. |
| 3 |
/** |
| 4 |
* Define Popovers for Timelines in WP Booking Calendar |
| 5 |
* |
| 6 |
* @returns {string|boolean} |
| 7 |
*/ |
| 8 |
function wpbc_define_tippy_popover(){ |
| 9 |
if ( 'function' !== typeof (wpbc_tippy) ){ |
| 10 |
console.log( 'WPBC Error. wpbc_tippy was not defined.' ); |
| 11 |
return false; |
| 12 |
} |
| 13 |
wpbc_tippy( '.popover_bottom.popover_click', { |
| 14 |
content( reference ){ |
| 15 |
var popover_title = reference.getAttribute( 'data-original-title' ); |
| 16 |
var popover_content = reference.getAttribute( 'data-content' ); |
| 17 |
return '<div class="popover popover_tippy">' |
| 18 |
+ '<div class="popover-close"><a href="javascript:void(0)" onclick="javascript:this.parentElement.parentElement.parentElement.parentElement.parentElement._tippy.hide();" >×</a></div>' |
| 19 |
+ popover_content |
| 20 |
+ '</div>'; |
| 21 |
}, |
| 22 |
allowHTML : true, |
| 23 |
trigger : 'manual', |
| 24 |
interactive : true, |
| 25 |
hideOnClick : false, |
| 26 |
interactiveBorder: 10, |
| 27 |
maxWidth : 550, |
| 28 |
theme : 'wpbc-tippy-popover', |
| 29 |
placement : 'bottom-start', |
| 30 |
touch : ['hold', 500], |
| 31 |
} ); |
| 32 |
jQuery( '.popover_bottom.popover_click' ).on( 'click', function (){ |
| 33 |
if ( this._tippy.state.isVisible ){ |
| 34 |
this._tippy.hide(); |
| 35 |
} else { |
| 36 |
this._tippy.show(); |
| 37 |
} |
| 38 |
} ); |
| 39 |
wpbc_define_hide_tippy_on_scroll(); |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
function wpbc_define_hide_tippy_on_scroll(){ |
| 45 |
jQuery( '.flex_tl__scrolling_section2,.flex_tl__scrolling_sections' ).on( 'scroll', function ( event ){ |
| 46 |
if ( 'function' === typeof (wpbc_tippy) ){ |
| 47 |
wpbc_tippy.hideAll(); |
| 48 |
} |
| 49 |
} ); |
| 50 |
} |
| 51 |
|