Kowshik
Kowshik

Reputation: 73

Fix a div using position:fixed for a particular direction

Is there a way to fix a div using position:fixed in only top to bottom direction; i.e when I scroll from left to right the div should not be fixed. It should behave as a absolute positioned element. It should be fixed only when I scroll from top to bottom. Is it possible?

Upvotes: 0

Views: 140

Answers (2)

Surinder ツ
Surinder ツ

Reputation: 1788

If you want pure good solution then, I would recommend you use jQuery. If you will implement it using CSS then it may not be smooth.

Upvotes: 0

It's not possible, because it's not supposed to be.

The action of "scrolling" may be very different from a browser to an other... from a device to an other... So it's not predictable.

Upvotes: 1

Related Questions