I have a made a sidebar with a toggle function in jquery. This is my function:
function toggle() {
var $btn = $(".sidebarToggle");
var $budget = $(".budget");
if ($budget.hasClass("sidebarHidden")) {
$btn.find("i").removeClass("fa-caret-right").addClass("fa-caret-left");
$budget.removeClass("sidebarHidden");
} else {
$btn.find("i").removeClass("fa-caret-left").addClass("fa-caret-right");
$budget.addClass("sidebarHidden");
}
$(window).trigger('resize');
}
And this is my HTML5 code:
<div class="sidebar sidebar-hastopnav autoscroll">
<div class="sidebarToggle" ng-click="vm.toggle()"><i class="fa fa fa-caret-left"></i></div>
The problem is when I click on the class it wont fire the $(window).trigger('resize');
function and it doesn't resize. I already check the other stackoverflow post like: jQuery resize event not firing
And
$(window).resize() not working
What am I doing wrong?
Kind regards.
Update: