Created
July 24, 2020 10:56
-
-
Save serhiosipatron/ae01378b41e605a656be2c1dd317613d 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
// Re-init sidebar function | |
var rtlsidebar = (function () { | |
let sidebarjs; | |
function init() { | |
var sidebarElement = $('#sidebarjs'); | |
var sidebarPosition = isRTL() ? "right" : "left"; | |
if (sidebarElement.length > 0) { | |
destroy(); | |
sidebarElement.show(); | |
sidebarjs = new SidebarJS.SidebarElement({ | |
position: sidebarPosition | |
}) | |
} | |
} | |
function destroy() { | |
sidebarjs && sidebarjs.destroy && sidebarjs.destroy(); | |
} | |
function isRTL() { | |
let value = $('body').attr('dir') == 'rtl'; | |
return value | |
} | |
return { | |
init : init | |
} | |
})(); | |
$(document).ready(function () { | |
rtlsidebar.init(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment