I need to swap icon and text based on the toggle using CSS. Initially the ribbon will be hidden. How do I do the icon and text swap based on the css class my JavaScript is assigning? is it the sliding door kind of technique?
HTML:
<div id="ribbonHide">
<a class="toolTipHover" href="#">
<div class="downArrowSmall">
<span class="ribbonHideToolTipOpen">Display the Ribbon</span>
<span class="ribbonHideToolTipClose">Hide the Ribbon</span>
</div>
</a>
</div>
JavaScript:
$('.toolTipHover > div').on('click', function() {
$('#s4-ribbonrow').toggle();
$(this).toggleClass('downArrowSmall upArrowSmall');
FixRibbonAndWorkspaceDimensions();
});
Adding some more context could be useful, but here is my guess to what you need.
You should at least use a function (Edit: I see you use a bind now) that toggles everything and i would use one span, so something like this: