Javascript snippet modification ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MrPutty
    New Member
    • Aug 2007
    • 13

    Javascript snippet modification ?

    Hello,

    I've aquired some Javascript that will kick in when a IE version < 6 comes to visit. It positions elements with a position:fixed effect. I need to add control for one more div container. Problem is - I don't have a clue about Javascript.

    This is the complete sheet:

    Code:
    html, body{
      background:url(foo) fixed;}
    #head, #footer, #navigation_oben{
      position:absolute;
      top:75px;
      z-index:10;}
    #head{
      top:expression(eval(document.compatMode && document.compatMode=='CSS1Compat') ? documentElement.scrollTop : document.body.scrollTop)}
    #wrap, #content-wrap {
      height:100%;}
    #content{
     padding:6em 1em;}
    #footer{
      top:expression(eval(document.compatMode && document.compatMode=='CSS1Compat') ? documentElement.scrollTop +(documentElement.clientHeight-this.clientHeight) : document.body.scrollTop +(document.body.clientHeight-this.clientHeight));}

    This controls the header and brings it up to the top (?)

    Code:
    #head{
      top:expression(eval(document.compatMode && document.compatMode=='CSS1Compat') ? documentElement.scrollTop : document.body.scrollTop)}
    I'd like the code to position the addtional div 75px down from the top of the viewport / directly underneath the #head object. Could someone please help me mod the code necessary ?



    regards.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    I don't think this code is a very good idea - mixing CSS with Javascript.

    However, if 'head' appears at the top, adding +75 to 'head2' (the additional div) should move it to the desired position.

    Comment

    • MrPutty
      New Member
      • Aug 2007
      • 13

      #3
      Ah, sweet - that works thanks! I'm not fond of using JS myself, but it seems the only way to achieve the desired effect. Are there any problems I should be aware of?

      What about the ActiveX warning posted by IE6 under WinXP? Is there a way to prevent this from happening?

      regards

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by MrPutty
        Ah, sweet - that works thanks! I'm not fond of using JS myself, but it seems the only way to achieve the desired effect. Are there any problems I should be aware of?
        Read about the viewport. Note that for a novice, it may not be an easy read.
        Originally posted by MrPutty
        What about the ActiveX warning posted by IE6 under WinXP? Is there a way to prevent this from happening?
        There is, but it's there for a reason. You can prevent it for yourself probably by adding your website to your trusted sites or signing the control, but it's up to each individual to decide what level they wish to keep their security.

        Comment

        Working...