(bug fix for internal links and story) |
(added script for scroll top button) |
||
Line 533: | Line 533: | ||
$hoverItem = $(this); | $hoverItem = $(this); | ||
$hoverItem.attr("src", "https://static.igem.org/mediawiki/2017/4/45/T--Bielefeld-CeBiTec--page-arrow-next-white.svg"); | $hoverItem.attr("src", "https://static.igem.org/mediawiki/2017/4/45/T--Bielefeld-CeBiTec--page-arrow-next-white.svg"); | ||
+ | }); | ||
+ | $("#page-arrow-top").mouseover(function() { | ||
+ | $hoverItem = $(this); | ||
+ | $hoverItem.attr("src", "page_arrow_top_white.svg"); | ||
}); | }); | ||
}); | }); | ||
Line 545: | Line 549: | ||
$hoverItem.attr("src", "https://static.igem.org/mediawiki/2017/c/c8/T--Bielefeld-CeBiTec--page-arrow-next.svg"); | $hoverItem.attr("src", "https://static.igem.org/mediawiki/2017/c/c8/T--Bielefeld-CeBiTec--page-arrow-next.svg"); | ||
}); | }); | ||
+ | $("#page-arrow-top").mouseout(function() { | ||
+ | $hoverItem = $(this); | ||
+ | $hoverItem.attr("src", "page_arrow_top.svg"); | ||
+ | }); | ||
+ | }); | ||
+ | |||
+ | function topFunction() { | ||
+ | document.body.scrollTop = 0; // For Chrome, Safari and Opera | ||
+ | document.documentElement.scrollTop = 0; // For IE and Firefox | ||
+ | } | ||
+ | |||
+ | $(window).scroll(function(){ | ||
+ | if ($(window).scrollTop() == 0) { | ||
+ | $("#page-arrow-top").css("display", "none"); | ||
+ | } else { | ||
+ | $("#page-arrow-top").css("display", "block"); | ||
+ | } | ||
+ | if ($(window).scrollTop() > 50) { | ||
+ | $("#page-arrow-top").css("opacity", 1); | ||
+ | } else { | ||
+ | $("#page-arrow-top").css("opacity", ($(window).scrollTop() / 50)); | ||
+ | } | ||
+ | if ($(window).scrollTop() > $(document).height() - $(window).height() - 80) { | ||
+ | $newPos = 20 + ($(window).scrollTop() - ($(document).height() - $(window).height() - 80)); | ||
+ | $("#page-arrow-top").css("bottom", $newPos + "px"); | ||
+ | } else { | ||
+ | $("#page-arrow-top").css("bottom", "20px"); | ||
+ | } | ||
}); | }); | ||
Revision as of 17:12, 14 October 2017