翻譯|使用教程|編輯:況魚杰|2019-11-21 14:51:08.460|閱讀 255 次
概述:默認情況下,可折疊標題小部件已展開。這是設計使然,標題下的內容可見,但可由用戶折疊。但是,您可以決定要使標題最初折疊。您可以通過向項目中添加一些自定義腳本來實現。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
HelpStudio以最快的,最簡單的方式創建和出版幫助系統,并與您的桌面或基于網絡的應用程序或組件整合起來,包括. NET。
Document! X包含了最新的制作工具,它允許你在預覽自動生成的頁面中直接增加內容-自動生成的文檔與功能齊全的注釋工具的無縫集成。使用Document! X,文檔可以在整個設計和開發過程中自動生成,而不需要花費開發人員的資源,同時為開發團隊提供了準確和最新的參考,并允許新的開發人員快速的學習新的組件和架構。
默認情況下,可折疊標題小部件已展開。這是設計使然,標題下的內容可見,但可由用戶折疊。但是,您可以決定要使標題最初折疊。您可以通過向項目中添加一些自定義腳本來實現。
注意:本文中的說明要求您使用的是Classic,Material或Light模板或從它們派生的自定義模板。
使用記事本在項目腳本目錄(例如headings-initially-collapsed.js)中創建一個新的javascript文件,然后復制并粘貼以下腳本:
(function () { // Define a new feature constructor var collapseAllOnLoadFeature = function(documentInstance) { Innovasys.Content.DocumentFeatureBase.call(this, documentInstance); }; // .. that inherits from the DocumentFeatureBase __extends(collapseAllOnLoadFeature, Innovasys.Content.DocumentFeatureBase); // Return a unique feature name collapseAllOnLoadFeature.prototype.getName = function () { return "Collapse All Toggle Sections On Load"; }; // Make sure it initializes after the built in features collapseAllOnLoadFeature.prototype.initializeContentOrdinal = function () { return 99999; } // When the content initializes, collapse any sections that are not already collapsed collapseAllOnLoadFeature.prototype.initializeContent = function (rootSelector, isInitialLoad) { var toggleFeature = this.documentInstance.getFeatureByName("Toggle Sections"); var expandedSections = $("." + toggleFeature.getToggleHeadingClassName() +":not(." + toggleFeature.getToggleHeadingClassName() + toggleFeature.getToggledSuffix() + ")"); toggleFeature.toggleSection(expandedSections, true); } // The factory is how we register our feature with the Innovasys document object var collapseAllOnLoadFactory = function() {}; collapseAllOnLoadFactory.prototype.createInstance = function (documentInstance) { return new collapseAllOnLoadFeature(documentInstance); }; // Register our factory in the DocumentFeatureConfiguration Innovasys.Content.DocumentFeatureConfiguration.registerDocumentFeatureFactory(new collapseAllOnLoadFactory()); })();
使用添加現有其他文件功能區命令將創建的.js文件添加到項目中。
重建輸出后,默認情況下,主題中的可折疊標題小部件現在將在生成的輸出中折疊。
但是以上代碼對于新的Material模板是不適用的,如果您需要在新的Material模板中實踐,您可以運用以下代碼運行,將其添加到項目或自定義模板中的.js文件中,并且頁面加載時所有部分都將折疊。:
(function () { // Define a new feature constructor var collapseAllOnLoadFeature = function(documentInstance) { Innovasys.Content.DocumentFeatureBase.call(this, documentInstance); }; // .. that inherits from the DocumentFeatureBase __extends(collapseAllOnLoadFeature, Innovasys.Content.DocumentFeatureBase); // Return a unique feature name collapseAllOnLoadFeature.prototype.getName = function () { return "Collapse All Toggle Sections On Load"; }; // Make sure it initializes after the built in features collapseAllOnLoadFeature.prototype.initializeContentOrdinal = function () { return 99999; } // When the content initializes, collapse any sections that are not already collapsed collapseAllOnLoadFeature.prototype.initializeContent = function (rootSelector, isInitialLoad) { var toggleFeature = this.documentInstance.getFeatureByName("Toggle Sections"); var expandedSections = $("." + toggleFeature.getToggleHeadingClassName() +":not(." + toggleFeature.getToggleHeadingClassName() + toggleFeature.getToggledSuffix() + ")"); toggleFeature.toggleSection(expandedSections, true); } // The factory is how we register our feature with the Innovasys document object var collapseAllOnLoadFactory = function() {}; collapseAllOnLoadFactory.prototype.createInstance = function (documentInstance) { return new collapseAllOnLoadFeature(documentInstance); }; // Register our factory in the DocumentFeatureConfiguration Innovasys.Content.DocumentFeatureConfiguration.registerDocumentFeatureFactory(new collapseAllOnLoadFactory()); })();
如果您對上面的問題有什么疑惑或者建議都可以在評論區留言,大家一起討論。
如果您對HelpStudio和Document! X感興趣,可以咨詢購買正版授權軟件。
關注慧聚IT微信公眾號 ???,了解產品的最新動態及最新資訊。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自: