My current jQuery animations for toggling the sidebar are as follows:
$('.sa-fixedNav_toggle').click(function () {
$('.sa-fixedNav_positon').toggleClass('sa-fixedNav_size-grow')
$('.pa-content_layout').toggleClass('pa-content_push-right')
$('.sa-fixedNav_expand-button').toggleClass('sa-fixedNav_expand-nav')
if($('.sa-fixedNav_positon').width() == 78) {
sideNavContentShow()
}
else {
setTimeout(() => {
sideNavContentHide()
},150);
}
})
function sideNavContentShow () {
$('.sa-fixedNav_content-expand').removeClass('hidden');
$('.sa-fixedNav_option-expand-icon').removeClass('hidden');
$('.sa-fixedNav_option-expandDown-icon').removeClass('hidden')
}
function sideNavContentHide () {
$('.sa-fixedNav_content-expand').addClass('hidden');
$('.sa-fixedNav_option-expand-icon').addClass('hidden');
$('.sa-fixedNav_option-expandDown-icon').addClass('hidden')
}
$('.sa-fixedNav_nav-links').click(function () {
$('.sa-fixedNav_option-expandDown-icon').toggleClass('sa-fixedNav_expand-hidden')
$('.sa-fixedNav_option-expand-icon').toggleClass('sa-fixedNav_expand-hidden')
})
I am now looking to replicate this functionality in Angular. I have attempted to use Renderer2
and @ViewChild
, but there is no direct equivalent to toggleClass
and I cannot find a method to retrieve the width. How would you recommend achieving this in Angular?