Team:Tsinghua-A/pop-ups.js

From 2013.igem.org

Revision as of 15:18, 7 September 2013 by Wangsy11 (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

/***************************/ //@Author: Adrian "yEnS" Mato Gondelle //@website: www.yensdesign.com //@email: yensamg@gmail.com //@license: Feel free to use it, but keep this credits please! /***************************/ //About Page Pop Up var popupAboutStatus = 0;

function loadPopupAbout(){ if(popupAboutStatus==0){ $("#popupAbout").fadeIn("slow"); popupAboutStatus = 1; } }

function disablePopupAbout(){ if(popupAboutStatus==1){ $("#popupAbout").fadeOut("slow"); popupAboutStatus = 0; } }

function centerPopupAbout(){ var windowWidth = document.documentElement.clientWidth; var windowHeight = document.documentElement.clientHeight; var popupAboutHeight = $("#popupAbout").height(); var popupAboutWidth = $("#popupAbout").width(); $("#popupAbout").css({ "position": "absolute", "top": windowHeight/2-popupAboutHeight/2, "left": windowWidth/2-popupAboutWidth/2 }); }


$(document).ready(function(){ $("#popupAbout").fadeOut(); popupAboutStatus = 0; $("#about").click(function(){ $("#popupAbout").css({ "visibility": "visible" }); disablePopupProjects(); disablePopupContact(); centerPopupAbout(); loadPopupAbout(); }); $("#popupAboutClose").click(function(){ disablePopupAbout(); }); }); $(function() { $('#popupAbout').jScrollPane(); $('.popupAbout').jScrollPane( { showArrows: true, horizontalGutter: 10 } ); }); //Projects Page Pop Up var popupProjectsStatus = 0;

function loadPopupProjects(){ if(popupProjectsStatus==0){ $("#popupProjects").fadeIn("slow"); popupProjectsStatus = 1; } }

function disablePopupProjects(){ if(popupProjectsStatus==1){ $("#popupProjects").fadeOut("slow"); popupProjectsStatus = 0; } }

function centerPopupProjects(){ var windowWidth = document.documentElement.clientWidth; var windowHeight = document.documentElement.clientHeight; var popupProjectsHeight = $("#popupProjects").height(); var popupProjectsWidth = $("#popupProjects").width(); $("#popupProjects").css({ "position": "absolute", "top": windowHeight/2-popupProjectsHeight/2, "left": windowWidth/2-popupProjectsWidth/2 }); }


$(document).ready(function(){ $("#popupProjects").fadeOut(); popupProjectsStatus = 0; $("#projects").click(function(){ $("#popupProjects").css({ "visibility": "visible" }); disablePopupAbout(); disablePopupContact(); centerPopupProjects(); loadPopupProjects(); }); $("#popupProjectsClose").click(function(){ disablePopupProjects(); }); }); $(function() { $('#popupProjects').jScrollPane(); $('.popupProjects').jScrollPane( { showArrows: true, horizontalGutter: 10 } ); }); //Contact Page Pop Up var popupContactStatus = 0;

function loadPopupContact(){ if(popupContactStatus==0){ $("#popupContact").fadeIn("slow"); popupContactStatus = 1; } }

function disablePopupContact(){ if(popupContactStatus==1){ $("#popupContact").fadeOut("slow"); popupContactStatus = 0; } }

function centerPopupContact(){ var windowWidth = document.documentElement.clientWidth; var windowHeight = document.documentElement.clientHeight; var popupContactHeight = $("#popupContact").height(); var popupContactWidth = $("#popupContact").width(); $("#popupContact").css({ "position": "absolute", "top": windowHeight/2-popupContactHeight/2, "left": windowWidth/2-popupContactWidth/2 }); }


$(document).ready(function(){ $("#popupContact").fadeOut(); popupContactStatus = 0; $("#contact").click(function(){ $("#popupContact").css({ "visibility": "visible" }); disablePopupAbout(); disablePopupProjects(); centerPopupContact(); loadPopupContact(); }); $("#popupContactClose").click(function(){ disablePopupContact(); }); }); $(function() { $('#popupContact').jScrollPane(); $('.popupContact').jScrollPane( { showArrows: true, horizontalGutter: 10 } ); });