Created
December 21, 2017 11:22
-
-
Save bjoerntx/00f3c78c2f1e6a51345e72a0810198e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ribbon can be manipulated when complete ribbon has been loaded | |
TXTextControl.addEventListener("ribbonTabsLoaded", function (e) { | |
// get the new tab container and add it after the existing last tab | |
$.get("/RibbonExtensions/NewTab/NewTab.html", function (data) { | |
$("ul.tabs:first li:last").after(data); | |
// attach the click event to switch tabs on a click | |
$("#tabNew").click(function () { | |
switchTabs($(this)); | |
}); | |
}); | |
// get the ribbon tab content and add it to the content container | |
$.get("/RibbonExtensions/NewTab/NewTabContent.html", function (data) { | |
$("#txRibbonTabContentContainer div:last").after(data); | |
}); | |
}); | |
// enables the clicked tab and disables other tabs | |
function switchTabs(tabObject) { | |
$('#txRibbonTabContentContainer div.tab-content').css("display", "none"); | |
$('#ribbonbar ul.tabs a').removeClass("selected"); | |
var id = tabObject.attr("rel"); | |
$('#' + id).css("display", "inline-block"); | |
tabObject.addClass("selected"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment