-3

i got the correct codes which could solved my problem, in previously posted questions : How do I get an image to fade in and out on a scroll using jQuery?

var divs = $('.banner');
$(window).scroll(function(){
if($(window).scrollTop()<10){
  divs.stop(true, true).fadeIn(5000);
} else {
   divs.stop(true, true).fadeOut(5000);}
});  

now I can't understand how to implement this code in blogger.

Community
  • 1
  • 1
Abhishek Sen
  • 338
  • 4
  • 10
  • 2
    First: What's your problem? Second: Where's the question? – cr0 Nov 16 '13 at 16:38
  • i want to make a div hidden, when scrolled upto a certain point say 500px from top, after crossing that point it could become visible again. – Abhishek Sen Nov 17 '13 at 07:54
  • this is link, where i found the answer http://stackoverflow.com/questions/17928132/how-do-i-get-an-image-to-fade-in-and-out-on-a-scroll-using-jquery – Abhishek Sen Nov 17 '13 at 07:58

1 Answers1

4

First include the jQuery in your <head> if you don't have it (this is compulsory, else you won't be able to use any jQuery code).

<script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js' type='text/javascript'></script>

Then paste this code in your <body> between the <script> tag

<script type="text/javascript">
var divs = $('.banner');
$(window).scroll(function(){
if($(window).scrollTop()<10){
  divs.stop(true, true).fadeIn(5000);
} else {
   divs.stop(true, true).fadeOut(5000);}
});  
</script>
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Rahul Shah
  • 1,387
  • 4
  • 22
  • 41