...
assets/js/ace-extra.js
assets/js/ace/ace.settings.js
(and later merged into assets/js/ace.js
for production site)
From Ace v1.3.5 on it's not required.
id
attribute and use .ace-save-state
class for it:
Using CSS3 animation events, the element's saved properties will be restored when it is inserted into DOM.
This will cause the element's status be restored as soon as it is inserted into DOM. The
try/catch
block is used so that if you don't want to use ace-extra.js
file and its functions,
the browser doesn't raise any errors.
ace.settings.saveState
to save an element's property or class name:
ace.settings.saveState('mycheckbox', 'checked'); ace.settings.saveState('sidebar', 'class', 'sidebar-fixed', true);Available arguements are:
class
class
.
If true
the value will be added to element's class name. If false
it will be removed
ace.settings.loadState('mycheckbox');
.navbar-fixed-top
class
to .navbar
element:
ace.settingFunction.navbar_fixed(null, true, true);//first parameter is null or reference to navbar element ace.settingFunction.navbar_fixed($('#navbar').get(0), true, true);First parameter is a reference to navbar element. If null
#navbar
will be used.
.breadcrumbs-fixed
class
to .breadcrumbs
element:
ace.settingFunction.breadcrumbs_fixed(null, true, true);//first parameter is null or reference to breadcrumbs element ace.settingFunction.breadcrumbs_fixed($('#breadcrumbs').get(0), true, true);First parameter is a reference to breadcrumbs element. If null
#breadcrumbs
will be used.
991px
which you can change that by modifying @screen-fixed-breadcrumbs
variable
inside assets/css/less/variables.less
files and recompiling ace.less
.
.container
class
to .navbar-container
and .main-container
elements:
...
ace.settingFunction.main_container_fixed(null, true, true);//first parameter is null or reference to container element ace.settingFunction.main_container_fixed($('#main-container')[0], true, true);First parameter is a reference to container element. If null
#main-container
will be used.
$(window).on('resize.auto_container', function() { var enable = $(this).width() > 1140; try { ace.settingFunction.main_container_fixed(enable, false, false); } catch(e) {} }).triggerHandler('resize.auto_container');
.sidebar-fixed
class
to .sidebar
element:
ace.settingFunction.sidebar_fixed(null, true, true);//first element is null or reference to sidebar element ace.settingFunction.sidebar_fixed($('#sidebar').get(0), true, true);First parameter is a reference to sidebar element. If null
#sidebar
will be used.
.menu-min
class
to .sidebar
element:
$('#sidebar').ace_sidebar('collapse', null, true); $('#sidebar').ace_sidebar('expand');First parameter is an optional reference to the toggle button.
settings.ace
and
has four extra arguments.
$(document).on('settings.ace', function(event, name, status, source, save) { //name is one of the following //navbar_fixed //sidebar_fixed //breadcrumbs_fixed //main_container_fixed //sidebar_collapsed //status is either true or false if(name == 'sidebar_fixed' && status == false) { //sidebar was unfixed by user, do something } }
presettings.ace
event triggered before making changes and can be used to prevent it or make some changes before proceeding:
$(document).on('presettings.ace', function(event, name, status, source, save) { //name is one of the following //navbar_fixed //sidebar_fixed //breadcrumbs_fixed //main_container_fixed //sidebar_collapsed //status is either true or false if(name == 'sidebar_fixed' && status == false) { event.preventDefault(); } }
.no-skin
.skin-1
.skin-2
.skin-3
To use .skin-3 you should add .no-skin
class as wellbody
element's class name:
<body class="skin-2"> ...
ace.css
but for other skins you should include ace-skins.css
ace.css
using another skin.
$('#ace-settings-skin').on('change', function() { ace.settings.set('skin', this.value); })And in your server side code:
$skin = $_COOKIE['ace_skin']; echo '<body class="'.$skin.'">'; //... //... echo '<li class="'.some_modification_based_on_selected_skin($skin).'">';Of course it's the simplest way and things would be different depending on your application
assets/css/ace-rtl.css
.rtl
class to body
element-right
or -left
.pull-right
& .pull-left
.no-padding-left
& .no-padding-right
.arrowed
& .arrowed-right
.make-ltr
and .make-rtl
classes:
$('#my-content').addClass('make-ltr') .find('.scroll-content').wrapInner('<div class="make-rtl" />');Some plugins support RTL and you should specify the options when initiating plugins:
.chosen-rtl
to the elementdirection:'rtl'
optionisRTL:true
optionisRTL:true
optionace-extra.js
ace-extra.js
and change ace.config
values.
//cookie functions ace.cookie.set(name, value, expires, path, domain, secure); ace.cookie.get(name); ace.cookie.remove(name, path);
//localStorage functions ace.storage.set(key, value); ace.storage.get(key); ace.storage.remove(key);
ace.data_storage
is a wrapper which by default chooses localStorage if available.
ace.data
is initiated by default:
/** ace.data = new ace.data_storage();//use localStorage if available otherwise use cookies ace.data = new ace.data_storage(1);//use localStorage ace.data = new ace.data_storage(2);//use cookies */ //save/load values with namespace (for example 'settings') //ace.data.set(namespace, key, value); ace.data.set('settings', 'sidebar-collapsed', 1); var collapsed = ace.data.get('settings', 'sidebar-collapsed'); ace.data.remove('settings', 'sidebar-collapsed'); //save/load values without namespace ace.data.set('username', 'alex'); var username = ace.data.get('username'); ace.data.remove('username');
var widget_list = {};//an object ace.data.set('demo', 'widget-order', widget_list, null, true); ace.data.get('demo', 'widget-order', true);The
true
value indicates that the value being saved/restored is an object.
.ace-settings-container
) should be the first child of
.page-content
.ace-settings-btn
and .ace-settings-box
which consists of several .ace-settings-item
elements:
. . ....