telegram_bots/static/js/custom.init.js

54 lines
934 B
JavaScript

$('.modal-basic').magnificPopup({
type: 'inline',
preloader: false,
modal: true
});
// 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]);