Jonathan Lyon
Jonathan Lyon

Reputation: 3952

prevent bootstrap affix moving div to left

I'm trying to prevent my right hand side div from moving to the left after I have used the affix property.

Any iudea how I do this please. You can see the issue here, just scroll down please:-

http://monkeygetnews.jonathanlyon.com/bs.html

Thanks

Jponathan

Upvotes: 6

Views: 5293

Answers (1)

David Taiaroa
David Taiaroa

Reputation: 25475

When activated, scroll spy adds the class affix and position: fixed to the div it's spying on. This positioning takes the div out of normal flow and here the result is that it's floating to the left.

The solution is to add some css styling to float it where you want. In your page I think it would be something like:

.span3.affix{
position: fixed; /* to stop the div from scrolling */
top: 0;          /* to fix the div at the top its containing element */
right: 0;        /* to fix the div at the right of its containing element */
}

You might have to play with this a bit to get it where you would like. The important thing is that once you know the selector (in this case) is .span3.affix it's easy enough to work with.

Good luck!

Upvotes: 9

Related Questions