Template:Kyoto/js

From 2012.igem.org

(Difference between revisions)
Line 3: Line 3:
<script type="text/javascript">
<script type="text/javascript">
$(function() {
$(function() {
-
     var element = $("#kyoto-menu");
+
     setScroll($("#kyoto-menu"));
-
    element.css("position","relative");
+
-
    $(window).scroll(function() {
+
-
                    var parent = element.parent();
+
-
                    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>

Revision as of 17:25, 25 September 2012