Python matplotlibを使って学ぶ統計処理 正規分布 新しいページはコチラ
提供: yonewiki
(→アニメーションマーカー) |
(→アニメーションマーカー) |
||
209行: | 209行: | ||
$(window).scroll(function (){ | $(window).scroll(function (){ | ||
$(".marker-animation").each(function(){ | $(".marker-animation").each(function(){ | ||
− | + | var position = $(this).offset().top; //ページの一番上から要素までの距離を取得 | |
− | + | var scroll = $(window).scrollTop(); //スクロールの位置を取得 | |
− | + | var windowHeight = $(window).height(); //ウインドウの高さを取得 | |
− | + | if (scroll > position - windowHeight){ //スクロール位置が要素の位置を過ぎたとき | |
− | + | $(this).addClass('active'); //クラス「active」を与える | |
− | } | + | } |
+ | }); | ||
+ | }); | ||
</script> | </script> | ||
<style type= "text/css"> | <style type= "text/css"> |