I am having a hard time trying to insert jquery code inside my PHP file. This is what I have so far.
</div>
<!-- left -->
<div class="col-lg-6 col-md-6">
<div id="rightside">
<img src="images/about/ab1.jpg" style="margin-left: 30px;">
</div>
This particular code is what I want to fade in when user scrolls down.
Inside your php file
<script>
var lastScrollTop = 0;
$(window).scroll(function(event){
var st = $(this).scrollTop();
if (st > lastScrollTop){
$('img').fadeIn();
}
lastScrollTop = st;
});
</script>
It's nothing to do with PHP, you can treat it with HTML as usual. So, you don't need to "insert" into PHP.
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
$(window).scroll(function () {
$("#rightside").fadeOut();
});
});
</script>
</head>
<body>
<div id="rightside">
<img src="images/about/ab1.jpg" style="margin-left: 30px;">
</div>
</body>
</html>
</div>