Difference between revisions of "Team:IISER-Kolkata/main.js"

(Created page with "$(window).on('resize',function() { location.reload(); }); $(window).on("load", function() { //navmenubar var sticky = $("#menubar").offset().top; $(window).s...")
 
Line 110: Line 110:
  
 
     //events page
 
     //events page
     $("#events .tab").hover(function() {
+
      
        $(this).css("background-color","#000040");
+
        $(this).children(".tab-text").css("background-color","#000040");
+
        $(this).children(".tab-text").css("color","white");
+
        $(this).children(".tab-text").css("border","0.5vw solid white");
+
    }, function() {
+
        $(this).css("background-color","white");
+
        $(this).children(".tab-text").css("background-color","white");
+
        $(this).children(".tab-text").css("color","#000040");
+
        $(this).children(".tab-text").css("border","0.5vw solid #000040");
+
    });
+
    $("#events .tab").click(function() {
+
        $(".tab").css("display","none");
+
        var tabID = $(this).children().attr("id");
+
        $("#"+tabID+"-pop").css("left","0vw");
+
    });
+
    $(".pop .exit").click(function() {
+
        $(".tab").css("display","flex");
+
        $(this).parent().css("left","100vw");
+
    });
+
    $(".type-list").click(function() {
+
        var nextList = $(this);
+
        var currentList = $(this).siblings(".list-active");
+
        currentList.removeClass("list-active");
+
        nextList.addClass("list-active");
+
        var nextListId = nextList.attr("id");
+
        var currentListId = currentList.attr("id");
+
        var nextHead = $(this).parent().siblings(".event-desc").children(".event-head#"+nextListId+"-head");
+
        var currentHead = $(this).parent().siblings(".event-desc").children(".event-head#"+currentListId+"-head");
+
        currentHead.removeClass("head-active");
+
        nextHead.addClass("head-active");
+
        var nextRem = $(this).parent().siblings(".event-desc").children(".rem-events#"+nextListId+"-rem");
+
        var currentRem = $(this).parent().siblings(".event-desc").children(".rem-events#"+currentListId+"-rem");
+
        currentRem.removeClass("rem-active");
+
        nextRem.addClass("rem-active");
+
        var nextEventId = $(this).parent().siblings(".event-desc").children(".indiv-event."+nextListId+"-first").attr("id");
+
        var currentEventId = $(this).parent().siblings(".event-desc").children(".indiv-event.event-active").attr("id");
+
        var firstEventId = $(this).parent().siblings(".event-desc").children(".indiv-event."+currentListId+"-first").attr("id");
+
        $(".indiv-event#"+currentEventId).removeClass("event-active");
+
        $(".indiv-event#"+nextEventId).addClass("event-active");
+
        var nextIconId = nextEventId.replace(nextListId+"-","");
+
        var currentIconId = currentEventId.replace(currentListId+"-","");
+
        var firstIconId = firstEventId.replace(currentListId+"-","");
+
        if(firstIconId!=currentIconId)
+
        {
+
            $(".icon#"+currentIconId).removeClass("icon-active");
+
            $(".icon#"+firstIconId).addClass("icon-active");
+
        }
+
    });
+
    $(".rem-events .icon").click(function() {
+
        var nextIcon = $(this);
+
        var currentIcon = $(this).siblings(".icon-active");
+
        currentIcon.removeClass("icon-active");
+
        nextIcon.addClass("icon-active");
+
        var nextIconId = nextIcon.attr("id");
+
        var currentIconId = currentIcon.attr("id"); 
+
        var currentListId = $(this).parent().attr("id").replace("-rem","");
+
        $(".indiv-event#"+currentListId+"-"+currentIconId).removeClass("event-active");
+
        $(".indiv-event#"+currentListId+"-"+nextIconId).addClass("event-active");   
+
    });
+
 
});
 
});
  
Line 176: Line 117:
 
var controller = new ScrollMagic.Controller();
 
var controller = new ScrollMagic.Controller();
 
 
var aboutUsAnim = new TimelineMax();
 
aboutUsAnim
 
.to('#sk1', 0.3, {left:"-7.5vw", opacity:1}, 0)
 
.to('#sk2', 0.3, {left:"91vw", opacity:1}, 0)
 
.to('#sk1', 0.3, {left:"-17.5vw", opacity:0.7}, "+=0.8")
 
.to('#sk2', 0.3, {left:"100vw", opacity:0.7}, "-=0.32");
 
 
 
 
//Pin each page
 
//Pin each page
 
var pinAboutUs = new ScrollMagic.Scene({triggerElement: '#aboutUs', triggerHook: 0, duration: '100%'})
 
var pinAboutUs = new ScrollMagic.Scene({triggerElement: '#aboutUs', triggerHook: 0, duration: '100%'})
 
.setPin('#aboutUs', {pushFollowers: false})
 
.setPin('#aboutUs', {pushFollowers: false})
.setTween(aboutUsAnim)
 
 
.addTo(controller);
 
.addTo(controller);
 
 

Revision as of 08:20, 21 June 2018

$(window).on('resize',function() {

   location.reload();

});

$(window).on("load", function() {

   //navmenubar
   var sticky = $("#menubar").offset().top; 
   $(window).scroll(function() {    
       if ($(window).scrollTop() > sticky) {
           $("#menubar").addClass("stickymenu");
       } else {
           $("#menubar").removeClass("stickymenu");
       } 
   });

var homePos = $("#home").offset().top;

   var aboutUsPos = $("#aboutUs").offset().top;
   var eventsPos = $("#events").offset().top;
   var galleryPos = $("#gallery").offset().top;
   var ourTeamPos = $("#ourTeam").offset().top;
   var sponsorsPos = $("#sponsors").offset().top;
   var reachUsPos = $("#reachUs").offset().top;
   $(document).on("click", "#pagedown", function() {

$("body, html").animate({scrollTop: aboutUsPos}, 1000, "swing"); }); $(document).on("click", "#homeMenu", function() {

       $("body, html").animate({scrollTop: homePos}, 1000, "swing");
   });
   $(document).on("click", "#aboutUsMenu", function() {
       $("body, html").animate({scrollTop: aboutUsPos}, 1000, "swing");
   });
   $(document).on("click", "#eventsMenu", function() {
       $("body, html").animate({scrollTop: eventsPos}, 1000, "swing");
   });
   $(document).on("click", "#galleryMenu", function() {
       $("body, html").animate({scrollTop: galleryPos}, 1000, "swing");
   });
   $(document).on("click", "#ourTeamMenu", function() {
       $("body, html").animate({scrollTop: ourTeamPos}, 1000, "swing");
   });
   $(document).on("click", "#sponsorsMenu", function() {
       $("body, html").animate({scrollTop: sponsorsPos}, 1000, "swing");
   });
   $(document).on("click", "#reachUsMenu", function() {
       $("body, html").animate({scrollTop: reachUsPos}, 1000, "swing");
   });  
   $(".pagelink#registerMenu").click(function() {
       $("#register").css("left","30vw");
       $("#login").css("left","-35vw");
   });
   $(".pagelink#loginMenu").click(function() {
       $("#login").css("left","35vw");
       $("#register").css("left","-45vw");
   });
   $("#register .exit").click(function() {
       $("#register").css("left","-45vw");
   });
   $("#login .exit").click(function() {
       $("#login").css("left","-35vw");
   });
   var halfHeight = window.innerHeight/2;
   $(window).scroll(function(){
       var windowPos = $(window).scrollTop() + 1;
       if (windowPos >= homePos && windowPos < aboutUsPos - halfHeight) {
           $(".pagelink").css("background-color","transparent");
           $(".pagelink").children().children().css("color","#bbbbbb");
           $(".pagelink#homeMenu").css("background-color","#bbbbbb");
           $(".pagelink#homeMenu div p").css("color","black");
       } 
       else if (windowPos >= aboutUsPos - halfHeight && windowPos < eventsPos - halfHeight) {
           $(".pagelink").css("background-color","transparent");
           $(".pagelink").children().children().css("color","#bbbbbb");
           $(".pagelink#aboutUsMenu").css("background-color","#bbbbbb");
           $(".pagelink#aboutUsMenu div p").css("color","black");
       }
       else if (windowPos >= eventsPos - halfHeight && windowPos < galleryPos - halfHeight) {
           $(".pagelink").css("background-color","transparent");
           $(".pagelink").children().children().css("color","#bbbbbb");
           $(".pagelink#eventsMenu").css("background-color","#bbbbbb");
           $(".pagelink#eventsMenu div p").css("color","black");
       }
       else if (windowPos >= galleryPos - halfHeight && windowPos < ourTeamPos - halfHeight) {
           $(".pagelink").css("background-color","transparent");
           $(".pagelink").children().children().css("color","#bbbbbb");
           $(".pagelink#galleryMenu").css("background-color","#bbbbbb");
           $(".pagelink#galleryMenu div p").css("color","black");
       }
       else if (windowPos >= ourTeamPos - halfHeight && windowPos < sponsorsPos - halfHeight) {
           $(".pagelink").css("background-color","transparent");
           $(".pagelink").children().children().css("color","#bbbbbb");
           $(".pagelink#ourTeamMenu").css("background-color","#bbbbbb");
           $(".pagelink#ourTeamMenu div p").css("color","black");
       }
       else if (windowPos >= sponsorsPos - halfHeight && windowPos < reachUsPos - halfHeight) {
           $(".pagelink").css("background-color","transparent");
           $(".pagelink").children().children().css("color","#bbbbbb");
           $(".pagelink#sponsorsMenu").css("background-color","#bbbbbb");
           $(".pagelink#sponsorsMenu div p").css("color","black");
       }
       else if (windowPos >= reachUsPos - halfHeight) {
           $(".pagelink").css("background-color","transparent");
           $(".pagelink").children().children().css("color","#bbbbbb");
           $(".pagelink#reachUsMenu").css("background-color","#bbbbbb");
           $(".pagelink#reachUsMenu div p").css("color","black");
       }
   });
   //events page
   

});

$(document).ready(function() { // Init ScrollMagic var controller = new ScrollMagic.Controller();


//Pin each page var pinAboutUs = new ScrollMagic.Scene({triggerElement: '#aboutUs', triggerHook: 0, duration: '100%'}) .setPin('#aboutUs', {pushFollowers: false}) .addTo(controller);

var pinEvents = new ScrollMagic.Scene({triggerElement: '#events', triggerHook: 0, duration: '100%'}) .setPin('#events', {pushFollowers: false}) .addTo(controller);

var pinGallery = new ScrollMagic.Scene({triggerElement: '#gallery', triggerHook: 0, duration: '100%'}) .setPin('#gallery', {pushFollowers: false}) .addTo(controller);

var pinOurTeam = new ScrollMagic.Scene({triggerElement: '#ourTeam', triggerHook: 0, duration: '100%'}) .setPin('#ourTeam', {pushFollowers: false}) .addTo(controller);

var pinSponsors = new ScrollMagic.Scene({triggerElement: '#sponsors', triggerHook: 0, duration: '100%'}) .setPin('#sponsors', {pushFollowers: false}) .addTo(controller); });