mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 09:52:06 +03:00
e5ce70e175
Saving post as draft, or publishing Added HBS parser for some client tmpls Parsing paginated posts Added grunt watch for hbs parsing on updates
38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
// # Toggle Support
|
||
|
||
/*global document, jQuery, Ghost */
|
||
(function ($) {
|
||
"use strict";
|
||
|
||
Ghost.temporary.initToggles = function ($el) {
|
||
|
||
$el.find('[data-toggle]').each(function () {
|
||
var toggle = $(this).data('toggle');
|
||
$(this).parent().children(toggle).hide();
|
||
});
|
||
|
||
$el.find('[data-toggle]').on('click', function (e) {
|
||
e.preventDefault();
|
||
$(this).toggleClass('active');
|
||
var toggle = $(this).data('toggle');
|
||
$(this).parent().children(toggle).fadeToggle(100).toggleClass('open');
|
||
});
|
||
|
||
};
|
||
|
||
|
||
$(document).ready(function () {
|
||
|
||
// ## Toggle Up In Your Grill
|
||
// Allows for toggling via data-attributes.
|
||
// ### Usage
|
||
// <nav>
|
||
// <a href="#" data-toggle=".toggle-me">Toggle</a>
|
||
// <ul class="toggle-me">
|
||
// <li>Toggled yo</li>
|
||
// </ul>
|
||
// </nav>
|
||
Ghost.temporary.initToggles($(document));
|
||
});
|
||
|
||
}(jQuery)); |