JQuery code not working on IE and firefox
I created a little jQuery code that works in Chrome and Opera, but not IE and Firefox.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js">
$(document).scroll(function () {
if ($('body')[0].scrollTop / $('body')[0].scrollHeight > 0.29) {
$(".over_one").fadeIn(2000);
} else {
$(".over_one").fadeOut(1);
}
});
</script>
I also searched here and here , but that didn't fix my problem.
+3
source to share
1 answer
I think you have an attribute src
and javascript inside your script tag. This should be split into 2 script tags.
Typically, you post as: (although this may not be a problem)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script>
$(document).ready(function () {
if ($('body')[0].scrollTop / $('body')[0].scrollHeight > 0.29) {
$(".over_one").fadeIn(2000);
} else {
$(".over_one").fadeOut(1);
}
});
</script>
+1
source to share