Add show/hide javascript as used for npoacct.

This commit is contained in:
Bradley M. Kuhn 2014-12-01 13:38:08 -05:00
parent 7276f0e17c
commit 00b0576bbb

View file

@ -6,6 +6,37 @@
<link href="/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="/jquery.min.js"></script>
<script type="text/javascript" src="/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.toggle-content').hide();
$('.toggle-control')
.addClass('clickable')
.bind('click', function() {
var $control = $(this);
var $parent = $control.parents('.toggle-unit');
$parent.toggleClass('expanded');
$parent.find('.toggle-content').slideToggle();
// if control has HTML5 data attributes, use to update text
if ($parent.hasClass('expanded')) {
$control.html($control.attr('data-expanded-text'));
} else {
$control.html($control.attr('data-text'));
}
});
$('a.donate-now')
.addClass('clickable')
.bind('click', function() {
var $control = $('#donate-box');
$control.toggleClass('expanded');
$control.find('.toggle-content').slideUp("slow");
$control.find('.toggle-content').slideDown("slow");
});
});
</script>
{% endblock %}