From 086307e563e23a928e12665b623608d26ba34588 Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 12 Jan 2015 18:07:14 -0500 Subject: [PATCH] Fix #1600 Sidebar not immediately available after init when wrong html --- RELEASE-NOTES.md | 1 + src/definitions/modules/sidebar.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 889583e59..9db396552 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -13,6 +13,7 @@ **Code / Build** - **Build** - `Dist/` files now set file permissions in build. `644` by default. Can adjust in `semantic.json` or during gulp install. You will need to run `npm install` to add the new gulp-chmod dependency *Thanks @PeterDaveHello* +- **Sidebar** - `setup layout` not occurs synchronously if you initialize a sidebar without the proper html. This makes sure calls to sidebar will occur correctly before the page is setup. A new setting `delaySetup` will override this, increasing performance. - **Modules** - Remove use of deprecated `.size()` for `.length` across all modules - **Modules** - Use of `$.proxy` swapped to native `function.call()` for performance gains across all modules diff --git a/src/definitions/modules/sidebar.js b/src/definitions/modules/sidebar.js index 61a662965..44bb1017e 100644 --- a/src/definitions/modules/sidebar.js +++ b/src/definitions/modules/sidebar.js @@ -93,7 +93,9 @@ $.fn.sidebar = function(parameters) { } // avoids locking rendering if initialized in onReady - requestAnimationFrame(module.setup.layout); + if(settings.delaySetup) { + requestAnimationFrame(module.setup.layout); + } module.instantiate(); }, @@ -1007,6 +1009,7 @@ $.fn.sidebar.settings = { dimPage : true, scrollLock : false, returnScroll : false, + delaySetup : false, useLegacy : 'auto', duration : 500,