Fix stuff

This commit is contained in:
Edin Dazdarevic
2017-10-05 02:38:46 +02:00
parent b84bae2ba3
commit cfe769a5a6
5 changed files with 166 additions and 131 deletions

View File

@@ -1,4 +1,29 @@
// $('.navbar-collapse a').click(function(){
// $(".navbar-collapse").collapse('hide');
// $('#nav-icon3').toggleClass('open');
// });
$('a.nav-link').click(function(e) {
var target = $($(this).attr("href"));
// x = position.left + parseInt($element.css('marginLeft'), 10);
var marginTop = parseInt(target.css('paddingTop'), 10);
$('html, body').animate({
// scrollTop: 700
scrollTop: target.offset().top - marginTop
}, 1000);
e.preventDefault();
return false;
// scrollTop: $("#myDiv").offset().top
});
if ($(window).width() < 767) {
$('.navbar-collapse a').click(function(){
$(".navbar-collapse").collapse('hide');
$('#nav-icon3').toggleClass('open');
});
$('.navbar-nav').removeClass('animated');
$('.above_item').addClass('carousel-inner');
$('#myCarousel').addClass('carousel slide');
@@ -16,54 +41,57 @@ if ($(window).width() < 767) {
$('.navbar-brand').removeClass('animated').attr('data-animation', '');
$(".go_there").prependTo($(".come_here"));
$('.carousel').bcSwipe({ threshold: 50 });
$(document).scroll(function() {
if (window.scrollY > 50) {
$(".header-wrap").stop().animate({
zoom: 0.5
});
$(".header-wrap").css("opacity", 1 - $(window).scrollTop() / 250);
} else {
$(".header-wrap").stop().animate({
zoom: 1
});
$(".header-wrap").css("opacity", 1);
}
});
// $(document).scroll(function() {
// TODO: revisit this
// if (window.scrollY > 50) {
// $(".header-wrap").stop().animate({
// zoom: 0.5
// });
// $(".header-wrap").css("opacity", 1 - $(window).scrollTop() / 250);
// } else {
// $(".header-wrap").stop().animate({
// zoom: 1
// });
// $(".header-wrap").css("opacity", 1);
// }
// });
var myCarousel = $('#myCarousel');
var itemFirst = myCarousel.find('.carousel-inner > .item:first-child');
var itemLast = myCarousel.find('.carousel-inner > .item:last-child');
var controlLeft = myCarousel.find('a.left.carousel-control');
var controlRight = myCarousel.find('a.right.carousel-control');
// var myCarousel = $('#myCarousel');
// var itemFirst = myCarousel.find('.carousel-inner > .item:first-child');
// var itemLast = myCarousel.find('.carousel-inner > .item:last-child');
// var controlLeft = myCarousel.find('a.left.carousel-control');
// var controlRight = myCarousel.find('a.right.carousel-control');
hideControl();
// hideControl();
myCarousel.on('slid.bs.carousel', function() {
hideControl();
});
myCarousel.on('slide.bs.carousel', function() {
showControl();
});
// myCarousel.on('slid.bs.carousel', function() {
// // hideControl();
// });
// myCarousel.on('slide.bs.carousel', function() {
// // showControl();
// });
function hideControl() {
if (itemFirst.hasClass('active')) {
controlLeft.css('display', 'none');
}
if (itemLast.hasClass('active')) {
controlRight.css('display', 'none');
myCarousel.carousel('pause'); // stop from cycling through items
}
}
// function hideControl() {
// if (itemFirst.hasClass('active')) {
// controlLeft.css('display', 'none');
// }
// if (itemLast.hasClass('active')) {
// controlRight.css('display', 'none');
// myCarousel.carousel('pause'); // stop from cycling through items
// }
// }
function showControl() {
if (itemFirst.hasClass('active')) {
controlLeft.css('display', 'block');
}
if (itemLast.hasClass('active')) {
controlRight.css('display', 'block');
}
}
// function showControl() {
// if (itemFirst.hasClass('active')) {
// controlLeft.css('display', 'block');
// }
// if (itemLast.hasClass('active')) {
// controlRight.css('display', 'block');
// }
// }
}
@@ -132,7 +160,7 @@ $(document).ready(function() {
[1400, 5],
[1600, 5]
],
navigation: true, // Show next and prev buttons
navigation: false, // Show next and prev buttons
slideSpeed: 300,
paginationSpeed: 400,
dots: true,
@@ -150,15 +178,15 @@ $(document).ready(function() {
var bodyEl = $("body");
$(window).on("scroll", function() {
var scrollTop = $(this).scrollTop();
$("section").each(function() {
var el = $(this),
var el = $("#second"),
className = el.attr("id");
if (el.offset().top <= scrollTop) {
bodyEl.addClass(className);
} else {
bodyEl.removeClass(className);
}
});
});
@@ -167,7 +195,7 @@ $(window).on("scroll", function() {
$(document).ready(function() {
var fadeStart = 900;
var fadeUntil = 1300;
$(window).scroll(function() {
var offset = $(document).scrollTop();
@@ -276,84 +304,84 @@ $(document).ready(function() {
});
/*======================For Mobile Animation=======================*/
if ($(window).width() < 767) {
// if ($(window).width() < 767) {
$(document).ready(function() {
var fadeStart_mob = 400;
var fadeUntil_mob = 1000;
// $(document).ready(function() {
// var fadeStart_mob = 400;
// var fadeUntil_mob = 1000;
$(window).scroll(function() {
var offset_mob = $(document).scrollTop();
// $(window).scroll(function() {
// var offset_mob = $(document).scrollTop();
if (offset_mob < fadeStart_mob) {
$(".brush").css('top', "57");
$(".brush-shadow").css('top', "60");
// if (offset_mob < fadeStart_mob) {
// $(".brush").css('top', "57");
// $(".brush-shadow").css('top', "60");
} else if (offset_mob >= fadeStart_mob && offset_mob <= fadeUntil_mob) {
$(".brush").animate({
top: "27",
}, 5000, function() {});
$(".brush-shadow").animate({
top: "37",
}, 6000, function() {});
// } else if (offset_mob >= fadeStart_mob && offset_mob <= fadeUntil_mob) {
// $(".brush").animate({
// top: "27",
// }, 5000, function() {});
// $(".brush-shadow").animate({
// top: "37",
// }, 6000, function() {});
} else if (offset_mob > fadeUntil_mob) {
$(".brush").css('top', "57");
$(".brush-shadow").css('top', "60");
// } else if (offset_mob > fadeUntil_mob) {
// $(".brush").css('top', "57");
// $(".brush-shadow").css('top', "60");
}
// }
});
});
// });
// });
$(document).ready(function() {
var fadeStart_mob1 = 800;
var fadeUntil_mob1 = 1300;
$(window).scroll(function() {
var offset_mob1 = $(document).scrollTop();
if (offset_mob1 < fadeStart_mob1) {
$(".box-img").css('top', "50");
$(".box-img-shadow").css('top', "55");
// $(document).ready(function() {
// var fadeStart_mob1 = 800;
// var fadeUntil_mob1 = 1300;
// $(window).scroll(function() {
// var offset_mob1 = $(document).scrollTop();
// if (offset_mob1 < fadeStart_mob1) {
// $(".box-img").css('top', "50");
// $(".box-img-shadow").css('top', "55");
} else if (offset_mob1 >= fadeStart_mob1 && offset_mob1 <= fadeUntil_mob1) {
$(".box-img").animate({
top: "20",
}, 5000, function() {});
$(".box-img-shadow").animate({
top: "30",
}, 6000, function() {});
} else if (offset_mob1 > fadeUntil_mob1) {
$(".box-img").css('top', "50");
$(".box-img-shadow").css('top', "55");
}
});
});
// } else if (offset_mob1 >= fadeStart_mob1 && offset_mob1 <= fadeUntil_mob1) {
// $(".box-img").animate({
// top: "20",
// }, 5000, function() {});
// $(".box-img-shadow").animate({
// top: "30",
// }, 6000, function() {});
// } else if (offset_mob1 > fadeUntil_mob1) {
// $(".box-img").css('top', "50");
// $(".box-img-shadow").css('top', "55");
// }
// });
// });
$(document).ready(function() {
var fadeStart_mob2 = 1100;
var fadeUntil_mob2 = 1700;
$(window).scroll(function() {
var offset_mob2 = $(document).scrollTop();
if (offset_mob2 < fadeStart_mob2) {
$(".hand").css('top', "60");
$(".hand-shadow").css('top', "65");
// $(document).ready(function() {
// var fadeStart_mob2 = 1100;
// var fadeUntil_mob2 = 1700;
// $(window).scroll(function() {
// var offset_mob2 = $(document).scrollTop();
// if (offset_mob2 < fadeStart_mob2) {
// $(".hand").css('top', "60");
// $(".hand-shadow").css('top', "65");
} else if (offset_mob2 >= fadeStart_mob2 && offset_mob2 <= fadeUntil_mob2) {
$(".hand").animate({
top: "20",
}, 5000, function() {});
$(".hand-shadow").animate({
top: "30",
}, 6000, function() {});
} else if (offset_mob2 > fadeUntil_mob2) {
$(".hand").css('top', "60");
$(".hand-shadow").css('top', "65");
}
});
});
// } else if (offset_mob2 >= fadeStart_mob2 && offset_mob2 <= fadeUntil_mob2) {
// $(".hand").animate({
// top: "20",
// }, 5000, function() {});
// $(".hand-shadow").animate({
// top: "30",
// }, 6000, function() {});
// } else if (offset_mob2 > fadeUntil_mob2) {
// $(".hand").css('top', "60");
// $(".hand-shadow").css('top', "65");
// }
// });
// });
}
// }
/*