fix turbolinks & sidebar

This commit is contained in:
bakatrouble 2019-01-11 23:35:22 +03:00
parent 1a27726cba
commit e7d9324df8
2 changed files with 48 additions and 48 deletions

View File

@ -3,3 +3,51 @@ $('.modal-basic').magnificPopup({
preloader: false, preloader: false,
modal: true 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]);

View File

@ -150,54 +150,6 @@ window.theme.fn = {
}).apply(this, [window.theme, jQuery]); }).apply(this, [window.theme, jQuery]);
// 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]);
// Cards // Cards
(function($) { (function($) {