Page scrolls up when I fadein a div and fade out another div?

The problem is happening because the wrapper feed-panel-wrapper has no height - so when you hide its content it shrinks to 0px height ... give the div a height or min-height.

Up vote 1 down vote favorite share g+ share fb share tw.

In http://albertanglada. Es I have this: $('#ultimas,#populares'). Click(function(e) { e.preventDefault(); $('.

Grupo').hide(); var id= 'div' + $(this). Attr('id'); $('. Grupo#'+id).fadeIn(); }); On http://albertanglada.

Es/js/custom. Js I use it to hide al . Groupo elementes and show an specific element.

It works, if you click on: 'Últimas añadidas' or 'Populares' in the middle of the page you'll see that some boxes are show/hidden. The problem is that also the page scrolls up if you are on the bottom. I don't want to scroll up the page when those span are clicked.

Últimas añadidas Populares javascript jquery scrolltop preventdefault link|improve this question edited Mar 8 at 19:05Peter O.4,2223915 asked Mar 8 at 16:10user588125445 67% accept rate.

I'd recommend you not use preventDefault() since it isn't fully supported by IE. Either do a return false; or if (e. PreventDefault) e.preventDefault(); else e.

ReturnValue = false; – xbonez Mar 8 at 16:12 1 You will need to wrap your elements with a div that can "force" the height of the page even though its child gets hidden. – Christofer Eliasson Mar 8 at 16:13 @xbonez the preventDefault() method is jQuery and is supported cross browser -> james.padolsey.com/jquery/#v=1.6.2&fn=jQuery.Event – ManseUK Mar 8 at 16:18.

The problem is happening because the wrapper feed-panel-wrapper has no height - so when you hide its content it shrinks to 0px height ... give the div a height or min-height #feed-panel-wrapper { min-height: 300px; }.

It works at first (with more height) thx! – user588125 Mar 8 at 16:27.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions