I am very new to jQuery, so please bear with me. I'm trying to make a div whose class is called "cover" fade in using its opacity CSS attribute. Here's the jQuery:
var div = $('.cover');
var divH = div.height();
$(window).on('scroll', function() {
var st = $(this).scrollTop();
div.css({ 'opacity' : (0 + st/divH) });
});
I have a JSFiddle with the CSS and HTML bits here: http://jsfiddle.net/ShubhangD/6xm0o8ta/. This seems like a simple thing to do, but it's not working at all. Can anyone please help me out?
Thanks in advance! :)
You're missing this script tag in your code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다