Skip to content

Instantly share code, notes, and snippets.

@joaomosantos
Last active December 14, 2015 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joaomosantos/5a048f06d53978816268 to your computer and use it in GitHub Desktop.
Save joaomosantos/5a048f06d53978816268 to your computer and use it in GitHub Desktop.
Javascript
function setDimensions(){
var windowsWidth = $(window).width();
$('.content img').css('width', windowsWidth + 'px');
}
$(document).ready(function() {
setDimensions();
});
$(window).resize(function() {
setDimensions();
});
var paths = [
'internacional/seguros-gratuitos-mastercard.',
'gold/seguros-gratuitos-mastercard.',
'gold/masterassist.'
];
var pathname = window.location.pathname;
for (var i = 0; i < paths.length; i++) {
var path = paths[i];
var regex = new RegExp(path);
if (regex.test(window.location.href)) {
$.magnificPopup.open({
items: {
src: '#magnific-popup'
}, type: 'inline'
}, 0);
}
}
$(document).ready(function() {
$(window).scroll(function() {
if ($(this).scrollTop() > 100) {
$('.icon-scroll').fadeIn();
} else {
$('.icon-scroll').fadeOut();
}
});
$('.icon-scroll').click(function(){
$('html, body').animate({scrollTop : 0 }, 800);
return false;
});
});
//Javascript
$(document).ready(function() {
$(window).scroll(function() {
$('.bar-content').toggleClass('is-fixed', $(this).scrollTop() > 200);
});
});
//CSS
.bar-content {
position:relative;
top: 0;
}
.is-fixed {
position: fixed;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment