user3328513
user3328513

Reputation: 199

fix an image into place so it follows scrolling up to certain point

http://www.designchemical.com/lab/demo-wordpress-jquery-vertical-mega-menu-plugin.html

The email icon at the corner of the page is the kind of thing that I want. It is a certain height from the top of the page and follows the page. I have managed to do this, however when I resize it goes it goes above where I want it to go. Here is my code atm:

b.remove(), a(this).hasClass("i-am-new") ? a(this).css({ top: (a(window).height()-600) + "px" }) :
            a(this).animate({ top: (a(window).height()) + "px" }, 500), window.innerWidth < 600 && a(this).css({ right: 5 })

So what I want it when you resize the window it stops after a certain point. At the moment it finds the height and resizes in that

Upvotes: 0

Views: 71

Answers (3)

rapshan sulimi
rapshan sulimi

Reputation: 66

You can use position:fixed for your case:

.mail{
    width:40px;
    height:40px;
    right:10px;
    top:50px;
    position:fixed;
    background:white;
}

See full example

Upvotes: 0

A J
A J

Reputation: 2140

Set position to fixed

position : fixed;

check this fiddle

I have placed a textbox for the sake of demo .. you may replace it with any control you want to.

Upvotes: 1

matt_lethargic
matt_lethargic

Reputation: 2786

If you want something to stay where it is use css position: absolute; float:right; top:40px; right:0;

This should work, but am on phone so can't test. I'm not sure what you meant by resize though so could be wrong.

Upvotes: 0

Related Questions