This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/assets/javascripts/lib/list-view.js

24 lines
791 B
JavaScript
Raw Permalink Normal View History

function loadViewPage(url) {
var $listView = $('#list-view');
$listView.empty().removeClass('in active');
$listView.load(url, function(response, status, xhr) {
$(this).addClass('in active');
})
}
$(function() {
$viewType = window.localStorage.getItem('viewType') || '#member-list';
$viewSwitchNo = window.localStorage.getItem('viewSwitchNo') || 0;
loadViewPage('member-list.html ' + $viewType);
$('.view-switch').children('.btn').eq($viewSwitchNo).addClass('active');
$('.view-switch').delegate(".btn", clickEvent, function(e){
var url = $(this).attr('href'),
ID = url.split("#"),
ID = '#' + ID[ID.length-1];
window.localStorage.setItem('viewType', ID);
window.localStorage.setItem('viewSwitchNo', $(this).index());
loadViewPage(url);
e.preventDefault();
});
})