2018-09-13 03:31:49 +02:00
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
var elems = document.querySelectorAll('.sidenav');
|
|
|
|
var options = {};
|
|
|
|
var instances = M.Sidenav.init(elems, options);
|
|
|
|
});
|
2017-03-12 03:02:54 +01:00
|
|
|
|
2018-09-13 03:31:49 +02:00
|
|
|
// Initialize collapsible (uncomment the lines below if you use the dropdown variation)
|
|
|
|
// var collapsibleElem = document.querySelector('.collapsible');
|
|
|
|
// var collapsibleInstance = M.Collapsible.init(collapsibleElem, options);
|
2017-03-12 03:02:54 +01:00
|
|
|
|
2018-09-13 03:31:49 +02:00
|
|
|
// Or with jQuery
|
2017-03-12 21:38:18 +01:00
|
|
|
|
2018-09-13 03:31:49 +02:00
|
|
|
$(document).ready(function(){
|
|
|
|
$('.sidenav').sidenav();
|
2018-09-14 03:53:46 +02:00
|
|
|
|
|
|
|
$('.sidenav > li > a').click(function(event){
|
|
|
|
|
|
|
|
event.preventDefault();//stop browser to take action for clicked anchor
|
|
|
|
|
|
|
|
//get displaying tab content jQuery selector
|
|
|
|
var active_tab_selector = $('.sidenav > li.active > a').attr('href');
|
|
|
|
|
|
|
|
//find actived navigation and remove 'active' css
|
|
|
|
var actived_nav = $('.sidenav > li.active');
|
|
|
|
actived_nav.removeClass('active');
|
|
|
|
|
|
|
|
//add 'active' css into clicked navigation
|
|
|
|
$(this).parents('li').addClass('active');
|
|
|
|
|
|
|
|
//hide displaying tab content
|
2018-09-16 03:19:46 +02:00
|
|
|
$(active_tab_selector).removeClass('active fade-in');
|
|
|
|
$(active_tab_selector).addClass('hide ');
|
2018-09-14 03:53:46 +02:00
|
|
|
|
|
|
|
//show target tab content
|
|
|
|
var target_tab_selector = $(this).attr('href');
|
2018-09-16 04:08:49 +02:00
|
|
|
$(target_tab_selector).removeClass('hide');
|
2018-09-16 03:19:46 +02:00
|
|
|
$(target_tab_selector).addClass('active fade-in');
|
2018-09-17 01:15:32 +02:00
|
|
|
|
|
|
|
// var instance = M.Sidenav.getInstance(document.querySelector('.sidenav'));
|
|
|
|
// instance.close();
|
2018-09-14 03:53:46 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
var hash = window.location.hash;
|
|
|
|
$('tab'+hash+':first').addClass('active');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
particlesJS.load('particles-js', 'assets/js/particlesjs-config.json', function() {
|
|
|
|
console.log('callback - particles.js config loaded');
|
2018-09-13 03:31:49 +02:00
|
|
|
});
|
2018-09-17 04:36:57 +02:00
|
|
|
|
|
|
|
// if ('serviceWorker' in navigator) {
|
|
|
|
// navigator.serviceWorker.register("{{ '/assets/js/service-worker.js| relative_url '}}").catch(function() {
|
|
|
|
// console.log("Error registering service worker");
|
|
|
|
// });
|
|
|
|
// }
|