我想在单击字体很棒的 V 形按钮时显示/隐藏表格。
以下代码来自http://jsfiddle.net/z0y0hp8o/6/。我想做同样的事情,但是在使用 java 互操作的 clojurescript 中。
(document).on('click', '.panel-heading span.clickable', function(e){
var $this = $(this);
if(!$this.hasClass('panel-collapsed')) {
$this.parents('.panel').find('.specialCollapse').slideUp();
$this.addClass('panel-collapsed');
$this.find('i').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down');
} else {
$this.parents('.panel').find('.specialCollapse').slideDown();
$this.removeClass('panel-collapsed');
$this.find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up');
} })
这是我在 clojurescript 中的草稿尝试。
(if (-> e -target -value
(.getElementsByClassName js/document "panel-collapsed"))
(do
(.slideUp js/document
(.find js/document ".specialCollapse"
(.parentElements js/document ".panel")))
(.addClass "panel-collapsed")
(.addClass "fas fa-chevron-down"
(.removeClass "fas fa-chevron-up"
(.find "i"))))
(do
(.slideDown js/document
(.find js/document ".specialCollapse"
(.parentElements js/document ".panel")))
(.removeClass "panel-collapsed")
(.addClass "fas fa-chevron-up"
(.removeClass "fas fa-chevron-down"
(.find "i")))))