Skip to content

Instantly share code, notes, and snippets.

@wurwal
Last active August 18, 2020 15:36
Show Gist options
  • Save wurwal/05107ed0f57e1fa5b4b7637bf20c2546 to your computer and use it in GitHub Desktop.
Save wurwal/05107ed0f57e1fa5b4b7637bf20c2546 to your computer and use it in GitHub Desktop.
tt ux.js additions
//ADD
// Fixing bug in reveal on mobile devices
var scrollPosition = 0;
var modalOpen = false;
var $reveal = $('.reveal');
$reveal.on('closeme.zf.reveal', function() {
if(!modalOpen) scrollPosition = $(document).scrollTop();
});
$reveal.on('open.zf.reveal', function() {
modalOpen = true;
});
$reveal.on('closed.zf.reveal', function() {
$(document).scrollTop(scrollPosition);
modalOpen = false;
});;
//ADD
// fixed mobile policy details button toggler
jQuery(function(){
jQuery(".view-current-details").click(function () {
jQuery(this).text(function(i, text){
return text === "View Current Details" ? "Hide Current Details" : "View Current Details";
})
});
})
// REPLACE CAROUSEL, to make slides faster, adjust autoplay time out at with ms at different breakpoints
// Carousels
$("#owl-cover-usp").owlCarousel({
nav: false,
touchDrag: false,
mouseDrag: false,
smartSpeed:450,
responsive:{
0:{
items:1,
nav:false,
loop:true,
margin:10,
autoplay:true,
//set ms here (half a second for mobile)
autoplayTimeout:500,
autoplayHoverPause:true
},
600:{
items:2,
nav:false,
loop:true,
margin:10,
autoplay:true,
autoplayTimeout:4000,
autoplayHoverPause:true
},
1000:{
items:4,
loop:false
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment