(Created page with "(function($, window, undefined) { "use strict"; jQuery(document).ready(function ($) { $(document).on('scroll', function () { // if the scroll distance is greater t...") |
|||
Line 80: | Line 80: | ||
$(this).attr('src',$(this).attr('data-orig')); | $(this).attr('src',$(this).attr('data-orig')); | ||
}); | }); | ||
+ | }); | ||
+ | $(function() { | ||
+ | $("#giflist li div ").hover( | ||
+ | // on mouse enter | ||
+ | function(e){ | ||
+ | //alert($(this).attr('id')); | ||
+ | $(this).children('.sameBulb').hide(); | ||
+ | $(this).children('.bulbChange').show(); | ||
+ | }, // over | ||
+ | function(e){ | ||
+ | // on mouse leave | ||
+ | $(this).children('.bulbChange').hide(); | ||
+ | $(this).children('.sameBulb').show(); | ||
+ | } | ||
+ | ); | ||
}); | }); | ||
Line 90: | Line 105: | ||
}); | }); | ||
− | |||
− | |||
− | |||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
$(function(){ | $(function(){ | ||
$('.icon_design').click(function() { | $('.icon_design').click(function() { | ||
Line 188: | Line 190: | ||
window.setTimeout(offsetAnchor, 1); | window.setTimeout(offsetAnchor, 1); | ||
+ | function extractPageName(hrefString) { | ||
+ | var arr = hrefString.split('/'); | ||
+ | return (arr.length<2) ? hrefString : arr[arr.length-2].toLowerCase() + arr[arr.length-1].toLowerCase(); | ||
+ | } | ||
+ | |||
+ | function setActiveMenu(arr, crtPage) { | ||
+ | for (var i=0; i<arr.length; i++) | ||
+ | { | ||
+ | if(extractPageName(arr[i].href) == crtPage) | ||
+ | { | ||
+ | if (arr[i].parentNode.tagName != "DIV") | ||
+ | { | ||
+ | arr[i].className = "current"; | ||
+ | arr[i].parentNode.className = "current"; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // call this method from your page | ||
+ | $(function setPage(){ | ||
+ | var hrefString; | ||
+ | hrefString = document.location.href ? document.location.href : document.location; | ||
+ | if (document.getElementById("pageHighlighter")!=null) | ||
+ | setActiveMenu(document.getElementById("pageHighlighter").getElementsByTagName("a"), extractPageName(hrefString)); | ||
+ | }); | ||
+ | |||
+ | // method for protocol page | ||
+ | $(document).ready(function(){ | ||
+ | $('.protocolhide').hide(); | ||
+ | $('#category-tabs li a').click(function(){ | ||
+ | $(this).next('ol').slideToggle('500'); | ||
+ | $(this).find('i').toggleClass('fa-chevron-circle-down fa-chevron-circle-up') | ||
+ | }); | ||
+ | }); | ||
+ | |||
+ | $("a").click(function(){ | ||
+ | $("a").removeClass("activeimage"); | ||
+ | $(this).addClass("activeimage"); | ||
+ | }); | ||
+ | |||
Revision as of 07:05, 12 September 2016
(function($, window, undefined) { "use strict";
jQuery(document).ready(function ($) {
$(document).on('scroll', function () { // if the scroll distance is greater than 100px if ($(window).scrollTop() > 100) { // do something $('.site-header').addClass('scrolled-header'); } else { $('.site-header').removeClass('scrolled-header'); } });
// go to top var offset = 300, offset_opacity = 1200, scroll_top_duration = 700, $back_to_top = $('.go-top'); //hide or show the "back to top" link $(window).on('scroll', function(){ ( $(this).scrollTop() > offset ) ? $back_to_top.addClass('go-top-visible') : $back_to_top.removeClass('go-top-visible go-top-fade-out'); if( $(this).scrollTop() > offset_opacity ) { $back_to_top.addClass('go-top-fade-out'); } });
//smooth scroll to top $back_to_top.on('click', function(event){ event.preventDefault(); $('body,html').animate({ scrollTop: 0 , }, scroll_top_duration ); });
$('nav.main-navigation > ul > li').each(function(){ $(this).find('.has-submenu').append(''); });
// Mobile navigation
$(".responsive-menu .menu-item-has-children").append(' ');$(".responsive-menu").on("click", ".show-submenu", function(e) { e.stopPropagation();
$(this).parent().toggleClass("current") .children(".sub-menu").toggleClass("open");
$(this).html($(this).html() == '' ? '' : ''); $(".nano").nanoScroller(); });
$(".responsive-menu").on("click", "a", function(e) { if( ($(this).attr('href') === "#") || ($(this).attr('href') === "") ) { $(this).parent().children(".show-submenu").trigger("click"); return false; } else { offcanvas_close(); } }); $(window).on("scroll", function() { if($(window).scrollTop() > 80) { $(".header").addClass("activeColour"); } else { //remove the background property so it comes transparent again (defined in your css) $(".header").removeClass("activeColour"); } });
$(function(){ $('#giflist li a img').hover(function(){ // on mouse enter var customdata = $(this).parent().attr('id'); $(this).attr('src',customdata); }, function(){ // on mouse leave $(this).attr('src',$(this).attr('data-orig')); }); });
$(function() {
$("#giflist li div ").hover( // on mouse enter function(e){ //alert($(this).attr('id')); $(this).children('.sameBulb').hide(); $(this).children('.bulbChange').show(); }, // over function(e){ // on mouse leave $(this).children('.bulbChange').hide(); $(this).children('.sameBulb').show(); } ); });
$(document).ready(function() { $('.icon_design').click(function() { //need to add if else here $('#teammeb1').removeClass('grayscale'); });
});
$(function(){ $('.icon_design').click(function() { $('.design').show(); $(".fundraising").hide(); $(".hardware").hide(); $(".IT").hide(); $(".pr").hide(); $(".wetlab").hide(); $(".organization").hide(); $(".defaultText").hide();
}); $('.icon_fundraising').click(function() { $('.design').hide(); $(".fundraising").show(); $(".hardware").hide(); $(".IT").hide(); $(".pr").hide(); $(".wetlab").hide(); $(".organization").hide(); $(".defaultText").hide(); }); $('.icon_hardware').click(function() { $('.design').hide(); $(".fundraising").hide(); $(".hardware").show(); $(".IT").hide(); $(".pr").hide(); $(".wetlab").hide(); $(".organization").hide(); $(".defaultText").hide(); }); $('.icon_IT').click(function() { $('.design').hide(); $(".fundraising").hide(); $(".hardware").hide(); $(".IT").show(); $(".pr").hide(); $(".wetlab").hide(); $(".organization").hide(); $(".defaultText").hide(); }); $('.icon_pr').click(function() { $('.design').hide(); $(".fundraising").hide(); $(".hardware").hide(); $(".IT").hide(); $(".pr").show(); $(".wetlab").hide(); $(".organization").hide(); $(".defaultText").hide(); }); $('.icon_wetlab').click(function() { $('.design').hide(); $(".fundraising").hide(); $(".hardware").hide(); $(".IT").hide(); $(".pr").hide(); $(".wetlab").show(); $(".organization").hide(); $(".defaultText").hide(); }); $('.icon_organization').click(function() { $('.design').hide(); $(".fundraising").hide(); $(".hardware").hide(); $(".IT").hide(); $(".pr").hide(); $(".wetlab").hide(); $(".organization").show(); $(".defaultText").hide(); });
});
function offsetAnchor() { if(location.hash.length !== 0) { window.scrollTo(window.scrollX, window.scrollY - 150); } } $(window).on("hashchange",offsetAnchor); window.setTimeout(offsetAnchor, 1);
function extractPageName(hrefString) {
var arr = hrefString.split('/'); return (arr.length<2) ? hrefString : arr[arr.length-2].toLowerCase() + arr[arr.length-1].toLowerCase(); }
function setActiveMenu(arr, crtPage) { for (var i=0; i<arr.length; i++) { if(extractPageName(arr[i].href) == crtPage) { if (arr[i].parentNode.tagName != "DIV") { arr[i].className = "current"; arr[i].parentNode.className = "current"; } } } }
// call this method from your page $(function setPage(){ var hrefString; hrefString = document.location.href ? document.location.href : document.location; if (document.getElementById("pageHighlighter")!=null) setActiveMenu(document.getElementById("pageHighlighter").getElementsByTagName("a"), extractPageName(hrefString)); });
// method for protocol page $(document).ready(function(){ $('.protocolhide').hide(); $('#category-tabs li a').click(function(){ $(this).next('ol').slideToggle('500'); $(this).find('i').toggleClass('fa-chevron-circle-down fa-chevron-circle-up') }); });
$("a").click(function(){ $("a").removeClass("activeimage"); $(this).addClass("activeimage"); });
});
})(jQuery, window);