aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/js/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/js/main.js')
-rw-r--r--assets/js/main.js93
1 files changed, 93 insertions, 0 deletions
diff --git a/assets/js/main.js b/assets/js/main.js
new file mode 100644
index 0000000..b9cfe34
--- /dev/null
+++ b/assets/js/main.js
@@ -0,0 +1,93 @@
+/******
+ GENERAL
+ ******/
+
+/*****
+ NAVBAR
+ *****/
+var $el, leftPos, newWidth,
+ $mainNav = $(".Navbar");
+$mainNav.append("<span class='NavbarLine'></span>");
+var $magicLine = $(".NavbarLine");
+$magicLine
+ .css("left", $(".ActiveTab").position().left)
+ .data("origLeft", $magicLine.position().left)
+ .data("origWidth", $magicLine.width());
+$(".NavbarIconWrap").on("click", function () {
+ $(".NavbarIconWrap").removeClass("ActiveTab");
+ $(this).addClass("ActiveTab");
+ var index = $(this).attr('id');
+ $('.MainTabWindows').slick('slickGoTo',index);
+ //$('.MainTabWindows').flickity().flickity('select', index);
+
+ $el = $(this);
+ leftPos = $el.position().left;
+ $magicLine.stop().animate({
+ left: leftPos,
+ width: newWidth,
+ }, 300);
+});
+
+/*******
+FLICKITY
+*******/
+$('.MainTabWindows').slick({
+ initialSlide: 2,
+ mobileFirst: true,
+ nextArrow: "",
+ prevArrow: "",
+ infinite: false,
+ zIndex: 500
+});
+
+$('.MainTabWindows').on('beforeChange', function(event, slick, currentSlide, nextSlide){
+ //console.log(nextSlide);
+ $(".NavbarIconWrap").removeClass("ActiveTab");
+ $el = $("#" + nextSlide);
+ $el.addClass("ActiveTab");
+ leftPos = $el.position().left;
+ $magicLine.stop().animate({
+ left: leftPos,
+ width: newWidth
+ }, 300);
+});
+
+/*
+$('.MainTabWindows').flickity({
+ cellAlign: 'left',
+ prevNextButtons: false,
+ pageDots: false,
+ friction: 0.3,
+ dragThreshold: ($("body").width() * 0.5),
+ initialIndex: 2,
+ wrapAround: true,
+ maxSwipeWidth: 0,
+ on: {
+ change: function (index) {
+ $(".NavbarIconWrap").removeClass("ActiveTab");
+ $el = $("#" + index);
+ $el.addClass("ActiveTab");
+ leftPos = $el.position().left;
+ $magicLine.stop().animate({
+ left: leftPos,
+ width: newWidth
+ }, 300);
+ },
+ dragStart: function () {
+ $(".ActiveTab").css({ transform: 'scale(1.05)' });
+ },
+ dragEnd: function () {
+ $(".NavbarIconWrap").css({ transform: 'scale(1.0)' });
+ }/*,
+ scroll: function (event, progress) {
+ var TotalWidth = $("body").width();
+ console.log(progress / 10);
+ leftPos = ((progress / 1000) * TotalWidth + 'px');
+ $magicLine.stop().animate({
+ left: leftPos,
+ width: newWidth
+ });
+ }*
+ }
+});
+*/ \ No newline at end of file