jquery fadeOut div unable to fadeIn

92
November 22, 2016, at 4:56 PM

I have adapted this fiddle http://jsfiddle.net/onqn2gjj/4/ to fade my search bar out on scroll, but once the search bar is gone, I cannot get it back by clicking the search icon.

How can I modify my script to stop this from happening please?

Here is the website: http://uwinat.o2clite.com/

Thanks

jQuery(document).ready(function($) {
$(window).scroll(function() {
if ($(this).scrollTop()>0)
 {
    $('.search').fadeOut();
 }
else
 {
  $('.search').fadeIn();
 }
   })
});
Answer 1

Is because on scroll you are hiding the parent of your element

you can see it here: http://screencast.com/t/zrnNrbeI

If you fix that it will work:http://screencast.com/t/H2m7K1636VER

Note

I also recomend you to use a debouncer for you scrolling event... the scroll event by it self would kill your performance... the UnderscoreJS library has a good one.

Also try using css animations instead of Jquery. You should always avoid using javascript animations...

READ ALSO
Not Sequencial Array to JSON (Keys are string)

Not Sequencial Array to JSON (Keys are string)

I'm trying to create a custom array, with custom array keys. [nnn]Until here everything works well.

125
JQuery function is working on Dev console, but not in load page

JQuery function is working on Dev console, but not in load page

I'm getting crazy because all was going so good, but now I don't understand why but a simply JQuery function is not working on webpage code when is loaded and when I put the code on the Developer Console is working perfectly. .

96
how do I use rails time_ago_in_words in backbone template

how do I use rails time_ago_in_words in backbone template

Is there a way to use rails standard methods such as time_ago_in_words in backbone template also using hamlc ? When I tried this.

121
Conditionally toggling CSS on $(window).resize()

Conditionally toggling CSS on $(window).resize()

I'm trying to run the following script and it doesn't seem to be working. I'm very much a noob and this is literally me testing and trying to figure out how things work.

94