сохранение в url вкладки

parent 3eb73f09
......@@ -9,7 +9,8 @@ $(document).ready(function () {
var
$switchItems = $('.switch-item'),
$formGroups = $('.form-group-data'),
classSelected = 'selected';
classSelected = 'selected',
currentType;
$switchItems.on('click', function(){
var
......@@ -19,10 +20,22 @@ $(document).ready(function () {
$switchItems.removeClass(classSelected);
$this.addClass(classSelected);
window.location.hash = type;
$formGroups.removeClass(classSelected);
$('.form-group-data[data-type="' + type + '"]').addClass(classSelected);
if (type == 'stat-common') {
window.dispatchEvent(new Event('resize'));
}
});
// Устанавливаем вкладку по url:
if(window.location.hash) {
currentType = $.trim(location.hash.replace('#', ''));
$('.switch-item[data-type="' + currentType + '"]').click();
}
})();
// Превьюшки:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment