mishad050
mishad050

Reputation: 448

Jquery code not working on IE and firefox

I've made a small jQuery code, which works on Chrome and Opera, but not on 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 have also searched here and here, but this was not fixing my problem.

Upvotes: 3

Views: 267

Answers (1)

filype
filype

Reputation: 8410

I think you have a src attribute and javascript code inside the script tag. This should be separated into 2 script tags.

Generally what you posted is written as: (though that may not be the 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>

Upvotes: 1

Related Questions