public-health-ch/publichealth/static/js/main.js

80 lines
1.9 KiB
JavaScript
Raw Normal View History

2017-02-15 09:59:12 +00:00
$(document).ready(function() {
2017-01-27 16:06:53 +00:00
2017-07-04 08:26:53 +00:00
// All external links in a new window
$('a[href^="http"]').filter(function() {
return this.hostname && this.hostname !== location.hostname;
}).attr('target', '_blank');
2017-09-08 14:37:33 +00:00
if ($('#carousel-banner').length) {
// Initialise front page carousel component
$('.carousel-inner').slick({
autoplay: true,
autoplaySpeed: '10000',
dots: true,
infinite: true,
speed: 1000,
fade: true,
cssEase: 'linear',
prevArrow: '<span class="arrow left glyphicon glyphicon-chevron-left" aria-hidden="true">Previous</span>',
nextArrow: '<span class="arrow right glyphicon glyphicon-chevron-right" aria-hidden="true">Next</span>',
});
} else if ($('.carousel-gallery').length) {
// Load gallery component
$('.carousel-gallery').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
asNavFor: '.slider-nav'
2017-09-08 14:37:33 +00:00
}).slickLightbox({
src: 'data-src',
itemSelector: 'img',
caption: 'caption',
captionPosition: 'bottom'
2017-09-08 14:37:33 +00:00
});
}
// Slider navigation
$('.slider-nav').slick({
slidesToShow: 3,
slidesToScroll: 1,
2017-09-20 15:10:35 +00:00
infinite: false,
centerMode: true,
focusOnSelect: true,
2017-09-20 15:10:35 +00:00
asNavFor: '.carousel-gallery',
// Responsive settings
responsive: [
{
breakpoint: 768,
settings: {
arrows: false,
centerMode: true,
centerPadding: '30px',
slidesToShow: 3
}
},
{
breakpoint: 480,
settings: {
arrows: false,
centerMode: true,
centerPadding: '30px',
slidesToShow: 1
}
}
],
prevArrow: '<span class="arrow left glyphicon glyphicon-chevron-left" aria-hidden="true">Previous</span>',
nextArrow: '<span class="arrow right glyphicon glyphicon-chevron-right" aria-hidden="true">Next</span>',
});
2017-09-08 14:37:33 +00:00
2017-01-27 16:06:53 +00:00
2017-09-05 09:14:12 +00:00
// Pastel colors on live news
// $('.feedpage-body .panel').each(function() {
// var hue = Math.floor(Math.random() * 360);
// var pastel = 'hsl(' + hue + ', 100%, 87.5%)';
// $(this).css('border-top', '3px solid ' + pastel);
// });
2017-07-04 09:07:53 +00:00
2017-01-27 16:06:53 +00:00
});