Hello! There is a code:

HTML:

div id="cate" 

CSS:

 #cate { position: absolute; left: 205px; top: 63.7px; width: 100px; height: 100px; background: url('images/cate2.png') no-repeat; } 

Js:

 $(document).ready(function(){ $("div#cate").click(function() { $(this).animate({ top: '150px' }); }); }); 

Everything is good, but as you write in css 'z-index: -999' js functions disappear. How to be? Help!

  • 2
    There can not be such that due to css JS does not work. And by the way, why quotes 'z-index: -999'? - ModaL
  • 2
    First, you have a special button to make the text code. - artuska
  • '' - It's like a quote. The element is visible, but the animation disappears. - bifot
  • 2
    {} Is like a code. - artuska
  • A picture of how? And still it is necessary downwards. And so that he could come under another block .. - bifot

2 answers 2

A negative index hides an element and you simply do not see it, respectively, you do not see how it is animated.

Here's a sandbox , it works.

    First top: 63.7px; value should be more inheriting ie more

     $(this).animate({ top: '150px' }); 

    The value of the parent must be greater than the heirs.