telegram_bots/static/js/custom.init.js

54 lines
934 B
JavaScript
Raw Normal View History

2019-01-11 19:16:01 +00:00
$('.modal-basic').magnificPopup({
type: 'inline',
preloader: false,
modal: true
});
2019-01-11 20:35:22 +00:00
// Bootstrap Toggle
(function($) {
'use strict';
var $window = $( window );
var toggleClass = function( $el ) {
if ( !!$el.data('toggleClassBinded') ) {
return false;
}
var $target,
className,
eventName;
$target = $( $el.attr('data-target') );
className = $el.attr('data-toggle-class');
eventName = $el.attr('data-fire-event');
$el.on('click.toggleClass', function(e) {
e.preventDefault();
$target.toggleClass( className );
var hasClass = $target.hasClass( className );
if ( !!eventName ) {
$window.trigger( eventName, {
added: hasClass,
removed: !hasClass
});
}
});
$el.data('toggleClassBinded', true);
return true;
};
$(function() {
$('[data-toggle-class][data-target]').each(function() {
toggleClass( $(this) );
});
});
}).apply(this, [jQuery]);