jquery - Different behavior on onclick event executed from image area shape and an html button -


I have a sample to describe my problem.

If you scroll to line 41 then you / show a fixed box. It works as expected: the semitransparent hides the box and the page remains cool. But if you click on the image below, the box also hides, but the page scroll is at the top.

How can this be avoided and the page is fixed where the user has scrolled it out?

  & lt; Div id = "container" & gt; & Lt; Div id = "box" class = "oculto" & gt; Box box & lt; / Div & gt; 1 & lt; Br> 2 & lt; Br> 3 & lt; Br> 4 & lt; Br> 5 & ​​lt; Br> 6 & lt; Br> 7 & lt; Br> 8 & lt; Br> 9 & lt; Br> 10 & lt; Br> 11 & lt; Br> 12 & lt; Br> 13 & lt; Br> 14 & lt; Br> 15 & lt; Br> 16 & lt; Br> 17 & lt; Br> 18 & lt; Br> 19 & lt; Br> 20 & lt; Br> 21 & lt; Br> 32 & lt; Br> 23 & lt; Br> 24 & lt; Br> 25 & lt; Br> 26 & lt; Br> 27 & lt; Br> 28 & lt; Br> 29 & lt; Br> 30 & lt; Br> 31 & lt; Br> 32 & lt; Br> 33 & lt; Br> 34 & lt; Br> 35 & lt; Br> 36 & lt; Br> 37 & lt; Br> 38 & lt; Br> 39 & lt; Br> 40 & lt; Br> & Lt; Button onclick = "$ ('# box'). Hide ();" & Gt; Hide box & lt; / Button & gt; & Lt; Br> & Lt; Button onclick = "$ ('# box'). Show ();" & Gt; Show box & lt; / Button & gt; & Lt; Br> & Lt; img src = "http://static.adzerk.net/Advertisers/4c4f1be011a447efbce49c1811022e7a.png" width = "330" border = "0" usemap = "# map" / & gt; & Lt; / Div & gt; & Lt; Map name = "map" id = "map" & gt; & Lt; Area size = "recit" cos = "3,3,320,84" href = "#" onclick = "$ ('# box'). Hide ();" />   

css

  # container {width: 400px; Background color: yellow; Status: Relative; Z-index: 2; Minute-height: 1000 pixels; } # Box {width: 400px; Height: 100px; Status: fixed; Top: 0; Z-index: 100000; Background color: black; Color: yellow; Opacity: 0.5; Padding: 10px; }    

Get rid of href on the map. I. & lt; Area shape = "reset" cows = "3,3,320,84" onclick = "$ ('# box'). Hide ();" />

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -