Skip to content

Instantly share code, notes, and snippets.

@edinsoncs
Created December 16, 2015 15:39
Show Gist options
  • Save edinsoncs/2c53e26f674f74b34f3a to your computer and use it in GitHub Desktop.
Save edinsoncs/2c53e26f674f74b34f3a to your computer and use it in GitHub Desktop.
function slider() {
var next = $(".itemSlider--Next");
var previus = $(".itemSlider--Previus");
$(next).click(function(){
//Active previus
setTimeout(function(){
$(".itemSlider--Previus").show('slow');
var itemSlide = $(".itemSlider--Show").animate({
'margin-left': '+=-343px'
}, 800, function(){
//alert('hola');
});
var s = $(itemSlide)[0].offsetLeft;
console.log(s);
if(s == -267 || s == -343 || s >= 686) {
$(".itemSlider--Next").hide('slow');
}
}, 300);
});
$(previus).click(function(){
setTimeout(function(){
var itemSlide = $(".itemSlider--Show").animate({
'margin-left': '+=+343px'
}, 800, function(){
//
//alert('hola');
});
var s = $(itemSlide)[0].offsetLeft;
console.log(s);
if(s == -343) {
$(".itemSlider--Previus").hide('slow');
$(".itemSlider--Next").show('slow');
}
else if(s == -686) {
$(".itemSlider--Next").show('slow');
}
}, 300);
});
}
slider();
function mobile(mobile){
var a = mobile;
var m = 0;
var p = 760;
if(a == 0 || a <= p) {
alert('estoy en un mobil');
}
}
mobile(window.innerWidth);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment