Template:Biomod/2013/Aarhus/Nano Creators/Begin

From OpenWetWare

(Difference between revisions)
Jump to: navigation, search
Current revision (13:27, 24 October 2013) (view source)
 
Line 132: Line 132:
});
});
-
$(document)
+
$(document).ready(
-
.ready(
+
function() {
-
function() {
+
var top = $('#tocScrol').offset().top
-
var top = $('#tocScrol').offset().top
+
- parseFloat($('#tocScrol').css('marginTop').replace(
-
- parseFloat($('#tocScrol').css('marginTop')
+
/auto/, 0));
-
.replace(/auto/, 0));
+
var nav = $('#tocScrol');
-
var nav = $('#tocScrol');
+
var max = $('#indexing').offset().top - nav.height();
-
var max = $('#indexing').offset().top - nav.height();
+
-
$(window).scroll(function(event) {
+
$(window).scroll(function(event) {
-
// what the y position of the scroll is
+
// what the y position of the scroll is
-
var y = $(this).scrollTop();
+
var y = $(this).scrollTop();
-
+
 
-
if (y > top) {
+
if (y > top) {
-
+
// && signs are html decoded thus this construction
-
if (y >= max) {
+
if (y >= max) {
-
nav.removeClass('fixed');
+
nav.removeClass('fixed');
-
nav.css({
+
nav.css({
-
position : 'absolute',
+
position : 'absolute',
-
top : max - top});
+
top : max - top
-
addPos('2 y: ' + y + " max:" + max);
+
});
-
} else {
+
} else {
-
nav.addClass('fixed');
+
nav.addClass('fixed');
-
nav.removeAttr('style');
+
nav.removeAttr('style');
-
addPos('1 y: ' + y + " max:" + max);
+
}
-
}
+
} else {
-
} else {
+
nav.removeClass('fixed');
-
nav.removeClass('fixed');
+
nav.removeAttr('style');
-
nav.removeAttr('style');
+
}
-
addPos('3 y: ' + y + " max:" + max);
+
});
-
}
+
});
-
});
+
-
});
+
-
+
-
function addPos($msg) {
+
-
//$('#editPageTxt').empty().append($msg);
+
-
}
+
</script>
</script>
<html>
<html>

Current revision