0

I need your help, i want to create a dynamic fixed DIV That means it a fixed div but it cant override header (or other div's above it) and footer (or other div's below it). Example when scroll on top it below other div but when scroll down enough it will be in top, and when scroll to bottom of pages it stand above other div. I don't know the key for this div is, so i call it "dynamic fixed div".

An example here: http://www.1stwebdesigner.com/wp-content/uploads/2010/07/index.html. I want to create a div like as "Select category" div.

Thanks!

Tamil Selvan C
  • 19,913
  • 12
  • 49
  • 70
user1912285
  • 112
  • 1
  • 7
  • 1
    We all want something, usually we try it ourself first. So, what have you tried? – A. Wolff May 25 '13 at 14:07
  • You will want to bind listeners to the height of the window and the positions of the header and footer and move them when the `heightOffset` is far enough based on your window's height. You also need to bind a `.resize()` (jQuery) function so you always have to most up-to-date window height, otherwise you get calculation faults. –  May 25 '13 at 14:10
  • Most browsers have "View source" capability. Combining that with the above link is all that you need here. – Vedran Šego May 25 '13 at 14:12
  • This may be a duplicate of http://stackoverflow.com/questions/1216114/how-can-i-make-a-div-stick-to-the-top-of-the-screen-once-its-been-scrolled-to?rq=1. – ASGM May 25 '13 at 15:06
  • Sorry for my late respond, i have slept and a bit busy from that time to now. i have some to solution and post to jsfiddle but it dont work right as my expect, i try solve this problem and post my result when complete, thanks! P/S: thank Tamil Selvan for fix my post, i have a bad English skill. – user1912285 May 26 '13 at 01:56
  • Finally i have created my own div code, but i can't "Answer My Question" so that i post my code here: – user1912285 May 26 '13 at 14:48
  • The code reach limit so I post my codes (include html, css, js) to Google Document: https://docs.google.com/file/d/0BzsDhK4WmYCgUTQ3WVZZQmFVcjg/edit?usp=sharing , anyone want view codes can visit that link. Thank everybody for helping me! – user1912285 May 26 '13 at 14:58

1 Answers1

1

You can use the css property "position: fixed;" to do it, and with Jquery you can do some effects interesting.

So, look this tutorial, I believe it'll help you.

http://www.sutanaryan.com/jquery/how-to-create-fixed-menu-when-scrolling-page-with-css-and-jquery/

  • The tutorial you gave to me is very useful for me, but it very simple so that it only can apply to horizontally menu on top. I want to creat a vertical DIV that it also can't override footer and other div below it too. I will creat it by myself, thank for your help – user1912285 May 26 '13 at 02:14