Template:Kyoto/js

From 2012.igem.org

(Difference between revisions)
 
(69 intermediate revisions not shown)
Line 2: Line 2:
<html>
<html>
<script type="text/javascript">
<script type="text/javascript">
 +
function showTab(tabname) {
 +
    var $children = $("#kyoto-tab-contents").children("div");
 +
$children.css("display","none");
 +
    document.getElementById(tabname).style.display = "block";
 +
}
 +
 +
function changeTab(tab) {
 +
var $tabs = $("#kyoto-tabs").children("li");
 +
$tabs.css("border-bottom","1px solid #c8c2b6");
 +
tab.css("border-bottom","none");
 +
}
 +
$(function() {
$(function() {
-
    var element = $("#kyoto-menu");
+
setScroll($("#kyoto-menu"));
-
    element.css("position","relative");
+
setScroll($(".kyoto-post-it"));
-
    $(window).scroll(function() {
+
        setScroll($("#goldenpost"));
-
                    var parent = element.parent();
+
$("#kyoto-tabs").children("li").click(function() { changeTab($(this)); });
-
                    if($(window).scrollTop() > parent.offset().top && (parent.height() + parent.position().top - 30) > ($(window).scrollTop() + element.height())) {
+
-
                        var scroll_top = $(window).scrollTop() - parent.offset().top;
+
-
                        element.css("top",scroll_top+"px");
+
-
                    } else if ($(window).scrollTop() < (parent.offset().top)) {
+
-
                        element.css("top","0px");
+
-
                    }
+
-
                    });
+
});
});
</script>
</script>
</html>
</html>

Latest revision as of 01:17, 27 October 2012