2017-08-04 16:28:16 +02:00
|
|
|
$(document).ready(function () {
|
2017-09-13 15:38:47 +02:00
|
|
|
// Fix per il menu principale
|
2018-05-05 14:54:47 +02:00
|
|
|
$('.sidebar-menu').tree({
|
|
|
|
followLink: true,
|
|
|
|
});
|
2017-08-30 11:50:46 +02:00
|
|
|
|
|
|
|
// Pulsante per il ritorno a inizio pagina
|
|
|
|
var slideToTop = $("<div />");
|
|
|
|
slideToTop.html('<i class="fa fa-chevron-up"></i>');
|
|
|
|
slideToTop.css({
|
|
|
|
position: 'fixed',
|
|
|
|
bottom: '20px',
|
|
|
|
right: '25px',
|
|
|
|
width: '40px',
|
|
|
|
height: '40px',
|
|
|
|
color: '#eee',
|
|
|
|
'font-size': '',
|
|
|
|
'line-height': '40px',
|
|
|
|
'text-align': 'center',
|
|
|
|
'background-color': 'rgba(255, 78, 0)',
|
|
|
|
'box-shadow': '0 0 10px rgba(0, 0, 0, 0.05)',
|
|
|
|
cursor: 'pointer',
|
|
|
|
'z-index': '99999',
|
|
|
|
opacity: '.7',
|
|
|
|
'display': 'none'
|
|
|
|
});
|
2017-09-13 15:38:47 +02:00
|
|
|
|
2017-08-30 11:50:46 +02:00
|
|
|
slideToTop.on('mouseenter', function () {
|
|
|
|
$(this).css('opacity', '1');
|
|
|
|
});
|
2017-09-13 15:38:47 +02:00
|
|
|
|
2017-08-30 11:50:46 +02:00
|
|
|
slideToTop.on('mouseout', function () {
|
|
|
|
$(this).css('opacity', '.7');
|
|
|
|
});
|
2017-09-13 15:38:47 +02:00
|
|
|
|
2017-08-30 11:50:46 +02:00
|
|
|
$('.wrapper').append(slideToTop);
|
|
|
|
$(window).scroll(function () {
|
|
|
|
if ($(window).scrollTop() >= 150) {
|
|
|
|
if (!$(slideToTop).is(':visible')) {
|
|
|
|
$(slideToTop).fadeIn(500);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$(slideToTop).fadeOut(500);
|
|
|
|
}
|
|
|
|
});
|
2017-09-13 15:38:47 +02:00
|
|
|
|
2017-08-30 11:50:46 +02:00
|
|
|
$(slideToTop).click(function () {
|
2017-09-13 15:38:47 +02:00
|
|
|
$("html, body").animate({
|
2017-08-30 11:50:46 +02:00
|
|
|
scrollTop: 0
|
|
|
|
}, 500);
|
|
|
|
});
|
2017-08-04 16:28:16 +02:00
|
|
|
});
|