企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
使用 ~~~ <span open-text="收起所有特权" close-text="查看所有特权" relevance-box="#tab_wrap" ></span> <div id="tab_wrap"> <!-- 特权内容,省略... --> </div> ~~~ 例图: ![](https://box.kancloud.cn/c84f1f50bbc65464eb2dad48c17bf131_1472x445.png) ![](https://box.kancloud.cn/2b7a65eabd373f8253f98a7ba5cdfee9_1059x160.png) 实现代码 ~~~ $('[relevance-box]').each(function(){ if( typeof(change_relevance_box_statux)=='undefined' ){ var change_relevance_box_statux = function(boxObj){ var relevance_box = boxObj.attr('relevance-box'); var obj = $(relevance_box); if( obj.is(':hidden') ){ obj.show(); var text_content = boxObj.attr('open-text'); var icon = 'fa fa-angle-up'; }else{ obj.hide(); var text_content = boxObj.attr('close-text'); var icon = 'fa fa-angle-down'; } var html = '<a href="javascript:;"><span>'+text_content+'</span>'+ '<i class="'+icon+'"></i>'+ '</a>'; boxObj.html(html); } } change_relevance_box_statux( $(this) ); $(this).click(function(){ change_relevance_box_statux( $(this) ); }) }) ~~~