My Easy way to make "Sticky Footers" with CSS.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sortie
    Confirmed User
    • Mar 2007
    • 7771

    #1

    My Easy way to make "Sticky Footers" with CSS.

    I saw someone asking for this in the hiring section, but it's so easy that I will
    post my code to do it here.

    This is an easy way to make those footers that always float at the bottom of
    your webpage even when the surfer scrolls like on youtube when viewing your playlist.

    This is the "framework" code. Just place your footer HTML inside the DIV tags.

    If you tried it before and it didn't work then maybe you didn't use a Doctype tag.
    Internet explorer needs the Doctype for this to work.

    The html for a page to do this is below and notice that the Doctype tag
    comes first before the HTML tag.

    Also note that if you have javascript/css doing things on your web page then
    this Doctype tag can change the way these things work in some cases, so
    you need to re-check everything to make sure it still works.


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <style type="text/css">
    .pos_fixed
    {
    position:fixed;
    bottom:0px;
    right:0px;
    }
    </style>
    </head>
    <body bgcolor=black text=white>


    <br>data data data data<br>

    <br>data data data data<br>




    <div class="pos_fixed" style="width:100%;background-color:darkgreen;border:solid yellow 1px;">
    <center>This is the footer that does not scroll. Place any HTML you like here.</center>
    </div>



    </body>
    </html>


    That's it; the key to this is in the CSS style sheet :

    You must set the position to "fixed".
    Then you must set the x and y position of the DIV tag using "bottom:" and "right:"
    (you could alternatively use "top:" and "left:").

    In the above "bottom:0px" means : place the Div data at position of zero pixels from the
    bottom.

    "right:0px" means place the Div data at position of zero pixels from the right.

    You can use positive or negative numbers also like "bottom:-10px";

    Play with it because it works kind of opposite of what some might think.
  • Verbal
    Confirmed User
    • Dec 2001
    • 3420

    #2
    Very cool sir, I thank you!

    Comment

    • CaptainWolfy
      Playa
      • Dec 2005
      • 8439

      #3
      tnx for sharing mate!

      Comment

      • sortie
        Confirmed User
        • Mar 2007
        • 7771

        #4
        More advanced :

        Add a toggle switch :

        This is used if you want to allow the surfer to remove the footer but be able to
        pull it back up.


        - First add "id=footer" to the DIV tag from above post
        - then add the code highlighted code below under the DIV tag


        <div id=footer class="pos_fixed" style="width:100%;background-color:darkgreen;border:solid yellow 1px;">
        <center>This is the footer that does not scroll. Place any HTML you like here.</center>

        </div>

        <script type="text/javascript">
        var mytog = 0;
        var putback = document.getElementById("footer").innerHTML;
        function footexpand() {
        if (mytog == 0) {
        document.getElementById("footer").innerHTML = "";
        mytog=1;
        }
        else {
        document.getElementById("footer").innerHTML = putback;
        mytog=0;
        }
        }
        </script>
        <span id=footerbutton style="position:fixed;right:0px;bottom:0px;backgro und-color:blue;border:solid red 1px;" onClick="footexpand();">^^</span>



        Use a gif or jpg image in the "footerbutton" span tag instead of the up arrows for a better looking button.


        .

        Comment

        • JD
          Too lazy to set a custom title
          • Sep 2003
          • 22651

          #5
          good stuff

          Comment

          • bns666
            Confirmed Fetishist
            • Mar 2005
            • 11553

            #6
            appreciated info
            CAM SODASTRIPCHAT
            CHATURBATEX LOVE CAM

            Comment

            • woj
              <&(©¿©)&>
              • Jul 2002
              • 47882

              #7
              put up a demo?
              Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
              Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
              Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

              Comment

              • sortie
                Confirmed User
                • Mar 2007
                • 7771

                #8
                Originally posted by woj
                put up a demo?
                Ok.

                This is the code above and what it does :

                http://ooaz.com/gfy/gfytest.html


                Of course this is just the "framework"; all kinds of stuff can go into the footer but
                putting a lot of stuff in sample code makes it more confusing.

                Comment

                • Ethersync
                  Confirmed User
                  • Mar 2008
                  • 5289

                  #9
                  Originally posted by sortie
                  Ok.

                  This is the code above and what it does :

                  http://ooaz.com/gfy/gfytest.html


                  Of course this is just the "framework"; all kinds of stuff can go into the footer but
                  putting a lot of stuff in sample code makes it more confusing.
                  Very cool. Thanks for sharing.
                  The best ePassporte replacement I have found: OKPAY

                  Comment

                  • alias
                    aliasx
                    • Apr 2001
                    • 19010

                    #10
                    Welcome back!
                    https://porncorporation.com

                    Comment

                    • u-Bob
                      there's no $$$ in porn
                      • Jul 2005
                      • 33063

                      #11
                      thnx

                      Comment

                      • Domain Broker
                        So Fucking Banned
                        • Oct 2004
                        • 2427

                        #12
                        not happy with the freebie.

                        Comment

                        • Tempest
                          Too lazy to set a custom title
                          • May 2004
                          • 10217

                          #13
                          Originally posted by sortie
                          More advanced :

                          Add a toggle switch :

                          This is used if you want to allow the surfer to remove the footer but be able to
                          pull it back up.


                          - First add "id=footer" to the DIV tag from above post
                          - then add the code highlighted code below under the DIV tag


                          <div id=footer class="pos_fixed" style="width:100%;background-color:darkgreen;border:solid yellow 1px;">
                          <center>This is the footer that does not scroll. Place any HTML you like here.</center>

                          </div>

                          <script type="text/javascript">
                          var mytog = 0;
                          var putback = document.getElementById("footer").innerHTML;
                          function footexpand() {
                          if (mytog == 0) {
                          document.getElementById("footer").innerHTML = "";
                          mytog=1;
                          }
                          else {
                          document.getElementById("footer").innerHTML = putback;
                          mytog=0;
                          }
                          }
                          </script>
                          <span id=footerbutton style="position:fixed;right:0px;bottom:0px;backgro und-color:blue;border:solid red 1px;" onClick="footexpand();">^^</span>



                          Use a gif or jpg image in the "footerbutton" span tag instead of the up arrows for a better looking button.


                          .
                          Instead of saving the contents and replacing it, why not just hide it? i.e. document.getElementById("footer").style.display="n one";

                          Comment

                          • scouser
                            marketer.
                            • Aug 2006
                            • 2280

                            #14
                            position:fixed doesn't work well in ie... http://www.quirksmode.org/css/contents.html

                            Comment

                            • sortie
                              Confirmed User
                              • Mar 2007
                              • 7771

                              #15
                              OK, now toggle the look of your button :

                              - You need to first move the "footerbutton" span tag above the script.
                              ( it must be defined in your browser before the script can access it to load the
                              first button)

                              - I can delete the up arrows from the span tag since the script now loads it

                              - Now add the aqua colored line of code to the same script as above.


                              <span id=footerbutton style="position:fixed;right:0px;bottom:0px;backgro und-color:blue;border:solid red 1px;" onClick="footexpand();"></span>

                              <script type="text/javascript">
                              var mytog = 0;
                              var putback = document.getElementById("footer").innerHTML;
                              document.getElementById("footerbutton").innerHTML = "X";

                              function footexpand() {
                              if (mytog == 0) {
                              document.getElementById("footer").innerHTML = "";
                              document.getElementById("footerbutton").innerHTML = "^^";
                              mytog=1;
                              }
                              else {
                              document.getElementById("footer").innerHTML = putback;
                              document.getElementById("footerbutton").innerHTML = "X";
                              mytog=0;
                              }
                              }
                              </script>


                              I updated the demo to show this : http://ooaz.com/gfy/gfytest.html


                              To use an images instead of "X" and "^^"

                              Just change this "

                              document.getElementById("footerbutton").innerHTML = "X";

                              to this :

                              document.getElementById("footerbutton").innerHTML = "<img src=/images/closebutton.jpg border=0>";


                              And change this :

                              document.getElementById("footerbutton").innerHTML = "X";

                              To this :

                              document.getElementById("footerbutton").innerHTML = "<img src=/images/showbutton.jpg border=0>";


                              * making sure that any quotes in the HTML are single quotes, because double quotes
                              are already used. (this is interchangeable)

                              Comment

                              • Renzo
                                Confirmed User
                                • Feb 2001
                                • 130

                                #16
                                hi,

                                thanks for the tutorial.
                                do i need xhtml doctype in order to get this work?

                                Comment

                                • sortie
                                  Confirmed User
                                  • Mar 2007
                                  • 7771

                                  #17
                                  Originally posted by Tempest
                                  Instead of saving the contents and replacing it, why not just hide it? i.e. document.getElementById("footer").style.display="n one";
                                  Because I did it the way that I thought would make it easier to understand.
                                  I mean, why not just embed it in a document.write for that matter and confuse the
                                  hell out of everybody.

                                  Or why not do an xmlHTTP request to get it and hide it altogether.
                                  And also, why put the javascript there when I can load it dynamically from a .js file.

                                  Or why not just do it in a flash object.

                                  Or..

                                  Or..


                                  Or why not just fucking do it and be done.

                                  Comment

                                  • IllTestYourGirls
                                    Ah My Balls
                                    • Feb 2007
                                    • 14311

                                    #18
                                    This great thanks. Do you have any ideas on making a facebook type footer?

                                    Comment

                                    • Inter-Sex
                                      Confirmed User
                                      • Nov 2005
                                      • 2231

                                      #19
                                      Originally posted by sortie
                                      Or why not just fucking do it and be done.
                                      Off Topic : Thats what i've mailed Chris serveral times, but not any response.
                                      On Toppic : Very cool Sortie, sure a lot gonna use it. I'm gonna give it also a shot at some sites.

                                      Comment

                                      • sortie
                                        Confirmed User
                                        • Mar 2007
                                        • 7771

                                        #20
                                        Originally posted by Renzo
                                        hi,

                                        thanks for the tutorial.
                                        do i need xhtml doctype in order to get this work?
                                        You need the Doctype I posted above or it will not work in internet explorer.

                                        There may be another Doctype that works but that's the one I know works
                                        for sure.

                                        Comment

                                        • sortie
                                          Confirmed User
                                          • Mar 2007
                                          • 7771

                                          #21
                                          Originally posted by deadmoon
                                          position:fixed doesn't work well in ie... http://www.quirksmode.org/css/contents.html
                                          Yeah, that's why you have to add the correct Doctype as stated above.

                                          Comment

                                          • rogueteens
                                            So fucking bland
                                            • Jul 2006
                                            • 8005

                                            #22
                                            excellent if i could rep, you'd have some.
                                            Free traffic and backlinks from one of the fastest growing adult pinsites on the net - SAUCY PICTURES!
                                            Easily my best performing webcam sponsor - CLICK HERE!!

                                            Comment

                                            • Renzo
                                              Confirmed User
                                              • Feb 2001
                                              • 130

                                              #23
                                              changing the doctype can have a massive impact. check w3c validator to see if it works with your code.
                                              Anybody tested with html 4.01 doctype?
                                              <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                                              "http://www.w3.org/TR/html4/loose.dtd">

                                              Comment

                                              • CYF
                                                Coupon Guru
                                                • Mar 2009
                                                • 10973

                                                #24
                                                nice stuff, thanks for sharing
                                                Webmaster Coupons Coupons and discounts for hosting, domains, SSL Certs, and more!
                                                AmeriNOC Coupons | Certified Hosting Coupons | Hosting Coupons | Domain Name Coupons

                                                Comment

                                                • sortie
                                                  Confirmed User
                                                  • Mar 2007
                                                  • 7771

                                                  #25
                                                  OK, lets move on to putting something in the footer and using images for the buttons.

                                                  - replace the text in the Div tag with HTML.
                                                  I'm putting a table there with images that link to pages.

                                                  - I'm going to use a gif for the close button that is the same height
                                                  as my other images in the table. The close gif has a red x box at top and is
                                                  clear at the bottom so that it will line up in the top right.

                                                  - I'm going to use a gif for the openbutton but it will not be as big as the
                                                  other images which will make it appear to shrink down when clicked.

                                                  - I nolonger want the back ground color etc for the button so I removed that
                                                  for the style element of the footerbutton span tag.


                                                  - now change the "X" and "^^" in the previous code to the proper image tags :

                                                  change this :
                                                  document.getElementById("footerbutton").innerHTML = "X"

                                                  to this :

                                                  document.getElementById("footerbutton").innerHTML = "<img src=/gfy/closebutton.gif border=0>";

                                                  change this :
                                                  document.getElementById("footerbutton").innerHTML = "^^"

                                                  to this :

                                                  document.getElementById("footerbutton").innerHTML = "<img src=/gfy/openbutton.gif border=0>";


                                                  DEMO : http://ooaz.com/gfy/gfytest002.html


                                                  Here is the new code :

                                                  <div id=footer class="pos_fixed" style="width:100%;background-color:darkgreen;border:solid yellow 1px;">
                                                  <center>

                                                  <table width=100% bgcolor=orange border=0 cellspacing=0 cellpadding=0 style="border:solid silver 1px;">
                                                  <tr>
                                                  <td><a href=/><img src=/logo01.jpg border=0></a></td>
                                                  <td><a href=/ooaz/poker.html><img src=/pokerbut.jpg border=0></a></td>

                                                  <td><a href=/ooaz/blackjack.html><img src=/blackjackbut.jpg border=0></a></td>
                                                  <td><a href=/ooaz/lucky7.html><img src=/lucky7but.jpg border=0></a></td>
                                                  <td><a href=/ooaz/wheeloff.html><img src=/wheeloffbut.jpg border=0></a></td>

                                                  </tr>
                                                  </table>




                                                  </center>

                                                  </div>


                                                  <span id=footerbutton style="position:fixed;right:0px;bottom:0px;" onClick="footexpand();"></span>
                                                  <script type="text/javascript">
                                                  var mytog = 0;
                                                  var putback = document.getElementById("footer").innerHTML;
                                                  document.getElementById("footerbutton").innerHTML = "<img src=/gfy/closebutton.gif border=0>";

                                                  function footexpand() {
                                                  if (mytog == 0) {
                                                  document.getElementById("footer").innerHTML = "";
                                                  document.getElementById("footerbutton").innerHTML = "<img src=/gfy/openbutton.gif border=0>";
                                                  mytog=1;
                                                  }
                                                  else {
                                                  document.getElementById("footer").innerHTML = putback;
                                                  document.getElementById("footerbutton").innerHTML = "<img src=/gfy/closebutton.gif border=0>";
                                                  mytog=0;
                                                  }
                                                  }
                                                  </script>

                                                  </body>
                                                  </html>

                                                  Comment

                                                  • Juicy D. Links
                                                    So Fucking Banned
                                                    • Apr 2001
                                                    • 122992

                                                    #26
                                                    put my face in the demo , lolol

                                                    Comment

                                                    • sortie
                                                      Confirmed User
                                                      • Mar 2007
                                                      • 7771

                                                      #27
                                                      Originally posted by Renzo
                                                      changing the doctype can have a massive impact. check w3c validator to see if it works with your code.
                                                      Anybody tested with html 4.01 doctype?
                                                      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                                                      "http://www.w3.org/TR/html4/loose.dtd">
                                                      Yes, they need to check their code when changing the Doctype.

                                                      I felt it was worth changing a few scripts on my site to work with the new
                                                      Doctype especially since having a doctype might help in SEO(don't know, just guessing)

                                                      Comment

                                                      • minicivan
                                                        Confirmed User
                                                        • Jun 2007
                                                        • 943

                                                        #28
                                                        Dude this is fucking awesome - I was looking for similar tutorials the other day. Thanks man.

                                                        Comment

                                                        • Sharky
                                                          Confirmed User
                                                          • Mar 2002
                                                          • 4938

                                                          #29
                                                          Great post. This is what webmaster boards used to be.. helping eachother. I can't + rep you, but I hope others will!
                                                          Sharky

                                                          Comment

                                                          • NaughtyRob
                                                            Two fresh affiliate progs
                                                            • Nov 2004
                                                            • 29602

                                                            #30
                                                            Good way to put ad banners that the surfer can close if they are annoyed. I like it.
                                                            [email protected]
                                                            Skype: 17026955414
                                                            Vacares Web Hosting - Protect Your Ass with Included Daily Backups

                                                            Comment

                                                            • sortie
                                                              Confirmed User
                                                              • Mar 2007
                                                              • 7771

                                                              #31
                                                              Ok, Let's add just one more thing and call it quits :


                                                              Instead of having links to my games in my footer, I'm just going to have the
                                                              game load on that page when the surfer mouses over the game name image in the
                                                              footer.

                                                              - I need a container for the game so I add an empty span tag :

                                                              <span id=gameholder style="position:fixed;top:100px;right:100px;z-index:1"></span>

                                                              I fixed the position and set the z-index to 1 so the game will show on top of the
                                                              other content on the page.

                                                              - I add a script called loadgame and it will receive a parameter named thisgame
                                                              whenever a game image is moused over.

                                                              - I will set the innerHTML of gameholder to equal embed code, but will have the game name
                                                              replaced with the parameter named thisgame.

                                                              this part sucks : your html will have to be concatenated for each line of code; meaning
                                                              you must put the + sign at the end of each line.
                                                              The entire html code must be enclosed in single quotes(can't conflict with double quotes)

                                                              Also the parameter named thisgame must be outside of all quotes so that it is recognized
                                                              as a variable and will be replaced with the correct game name.

                                                              Example :

                                                              this code :

                                                              <tag something="something"></tag>
                                                              <tag another="thisgame"></tag>

                                                              Becomes this :

                                                              '<tag something="something"></tag>' +
                                                              '<tag another="' + thisgame + '"></tag>'

                                                              * Note the tiny yellow single quotes in the interior!!!!!!!

                                                              - now add the mouseover code to each image in the footer like this
                                                              <img src=/pokerbut.jpg border=0 onmouseover="loadgame('poker.swf')">


                                                              - I want a button to close the game so I use my same close button and add this
                                                              code to the innerHTML for the gameholder :

                                                              <img align=right src=/gfy/closebutton.gif border=0 onclick="gameout();">


                                                              DEMO : http://ooaz.com/gfy/gfytest003.html





                                                              Here's the new code : (board changed ":" and "D" to smile with glasses in classid)

                                                              <script type="text/javascript">
                                                              var thisgame = "";
                                                              function loadgame(thisgame) {

                                                              document.getElementById("gameholder").innerHTML =
                                                              '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+
                                                              'id=test width=768 height=346 '+
                                                              'codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=7,0,0,0"> '+
                                                              '<param name="movie" value="/ooaz/' + thisgame + '"> '+
                                                              '<param name="quality" value="high"> '+
                                                              ' <param name="play" value="true"> '+
                                                              ' <param name="loop" value="true"> '+
                                                              ' <param name="allowfullscreen" value="true"> '+
                                                              '<param name="bgcolor" value="#000000"> '+
                                                              '<embed src="/ooaz/' + thisgame + '" '+
                                                              'width=768 height=346 bgcolor="#000000" quality="high" loop="true" allowfullscreen="true" '+
                                                              'TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/"> '+
                                                              '</EMBED> '+
                                                              '</OBJECT> <img align=right src=/gfy/closebutton.gif border=0 onclick="gameout();">';

                                                              }
                                                              function gameout() {
                                                              document.getElementById("gameholder").innerHTML = "";


                                                              }
                                                              </script>

                                                              <div id=footer class="pos_fixed" style="width:100%;background-color:darkgreen;border:solid yellow 1px;">
                                                              <center>

                                                              <table width=100% bgcolor=orange border=0 cellspacing=0 cellpadding=0 style="border:solid silver 1px;">
                                                              <tr>
                                                              <td><a href=/><img src=/logo01.jpg border=0></a></td>
                                                              <td><a href=/ooaz/poker.html><img src=/pokerbut.jpg border=0 onmouseover="loadgame('poker.swf')"></td>

                                                              <td><img src=/blackjackbut.jpg border=0 onmouseover="loadgame('blackjack.swf')"></td>
                                                              <td><img src=/lucky7but.jpg border=0 onmouseover="loadgame('lucky7.swf')"></td>
                                                              <td><img src=/wheeloffbut.jpg border=0 onmouseover="loadgame('wheeloff.swf')"></td>

                                                              </tr>
                                                              </table>



                                                              </center>

                                                              </div>




                                                              <span id=gameholder style="position:fixed;top:100px;right:100px;z-index:1"></span>

                                                              <span id=footerbutton style="position:fixed;right:0px;bottom:0px;" onClick="footexpand();"></span>
                                                              <script type="text/javascript">
                                                              var mytog = 0;
                                                              var putback = document.getElementById("footer").innerHTML;
                                                              document.getElementById("footerbutton").innerHTML = "<img src=/gfy/closebutton.gif border=0>";

                                                              function footexpand() {
                                                              if (mytog == 0) {
                                                              document.getElementById("footer").innerHTML = "";
                                                              document.getElementById("footerbutton").innerHTML = "<img src=/gfy/openbutton.gif border=0>";
                                                              mytog=1;
                                                              }
                                                              else {
                                                              document.getElementById("footer").innerHTML = putback;
                                                              document.getElementById("footerbutton").innerHTML = "<img src=/gfy/closebutton.gif border=0>";
                                                              mytog=0;
                                                              }
                                                              }
                                                              </script>




                                                              Well that was kind of fun; especially since I made that up as I went along.


                                                              This would have been better if I had planned it and made better graphics etc but
                                                              I hope it works for you.
                                                              Last edited by sortie; 10-19-2010, 05:50 PM.

                                                              Comment

                                                              • sortie
                                                                Confirmed User
                                                                • Mar 2007
                                                                • 7771

                                                                #32
                                                                Originally posted by IllTestYourGirls
                                                                This great thanks. Do you have any ideas on making a facebook type footer?
                                                                Sorry I missed your question.

                                                                I haven't joined facebook so I don't know what their footer does.

                                                                Chances are pretty good that I could make one though.

                                                                Comment

                                                                • potter
                                                                  Confirmed User
                                                                  • Dec 2004
                                                                  • 6559

                                                                  #33
                                                                  Giving a DIV tag 100% width?

                                                                  And using CENTER tags?

                                                                  And using PX for 0 attributes?

                                                                  And not using JQUERY for the scripting?

                                                                  The CSS for the div should be:

                                                                  Code:
                                                                  .whateverclass{
                                                                  position:fixed;
                                                                  z-index:99999999; /* only needed if you have other positioned elements on the page */
                                                                  left:0;
                                                                  bottom:0
                                                                  }
                                                                  You div would be

                                                                  Code:
                                                                  <div class="whateverclass">HTML HERE</div>
                                                                  Then, us jquery for the hide/show

                                                                  Code:
                                                                  <script>
                                                                  $('.closeclass').click(function() {
                                                                    $('.whateverclass').hide();
                                                                    $('.showclass').show();
                                                                  });
                                                                  
                                                                  $('.showclass').click(function() {
                                                                    $('.whateverclass').show();
                                                                    $('.showclass').hide();
                                                                  });
                                                                  </script>
                                                                  .whateverclass = the fixed div
                                                                  .closeclass = the link to close the fixed div
                                                                  .showclass = the link to reshow the fixed div

                                                                  clicking the .closeclass link hides the fixed div, and it shows the reshow link. and then clicking the reshow link shows the fixed div and hides the reshow link.

                                                                  So you'd also have these two links somewhere on your page (obviously don't put the reshow link in the fixed div, because it wouldn't be visible unless the div was as well.

                                                                  Code:
                                                                  <a href="" class="closeclass">close</a>
                                                                  <a href="" class="showclass">show</a>

                                                                  didn't mean to piss in your cheereos here but the code you posted is some seriously bloated and out of date load of html.

                                                                  Comment

                                                                  • sortie
                                                                    Confirmed User
                                                                    • Mar 2007
                                                                    • 7771

                                                                    #34
                                                                    potter's code :
                                                                    Originally posted by potter

                                                                    whateverclass{
                                                                    position:fixed;
                                                                    z-index:99999999; /* only needed if you have other positioned elements on the page */
                                                                    left:0;
                                                                    bottom:0
                                                                    }

                                                                    <div class="whateverclass">HTML HERE</div>

                                                                    <script>
                                                                    $('.closeclass').click(function() {
                                                                    $('.whateverclass').hide();
                                                                    $('.showclass').show();
                                                                    });

                                                                    $('.showclass').click(function() {
                                                                    $('.whateverclass').show();
                                                                    $('.showclass').hide();
                                                                    });
                                                                    </script>
                                                                    <a href="" class="closeclass">close</a>
                                                                    <a href="" class="showclass">show</a>[/code]

                                                                    My code :

                                                                    Originally posted by me
                                                                    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                                                                    <style type="text/css">
                                                                    .pos_fixed
                                                                    {
                                                                    position:fixed;
                                                                    bottom:0px;
                                                                    right:0px;
                                                                    }
                                                                    </style>
                                                                    <div id=footer class="pos_fixed" style="width:100%;background-color:darkgreen;border:solid yellow 1px;">
                                                                    <center>This is the footer that does not scroll. Place any HTML you like here.</center>
                                                                    </div>
                                                                    <span id=footerbutton style="position:fixed;right:0px;bottom:0px;backgro und-color:blue;border:solid red 1px;" onClick="footexpand();"></span>
                                                                    <script type="text/javascript">
                                                                    var mytog = 0;
                                                                    var putback = document.getElementById("footer").innerHTML;
                                                                    document.getElementById("footerbutton").innerHTML = "X";
                                                                    function footexpand() {
                                                                    if (mytog == 0) {
                                                                    document.getElementById("footer").innerHTML = "";
                                                                    document.getElementById("footerbutton").innerHTML = "^^";
                                                                    mytog=1;
                                                                    }
                                                                    else {
                                                                    document.getElementById("footer").innerHTML = putback;
                                                                    document.getElementById("footerbutton").innerHTML = "X";
                                                                    mytog=0;
                                                                    }
                                                                    }
                                                                    </script>
                                                                    Anyone can copy my code quoted above and it will work with nothing else added.
                                                                    Try it. Your code cannot be copied into a webpage and work as is and needs a
                                                                    175k library called jquery to execute. So how are you using "less code"?


                                                                    You didn't write any code to position the hide/show links.
                                                                    When the surfer scrolls he'll have to scroll back the other way to click your
                                                                    hide/show links.

                                                                    Why are you using anchor tags if the surfer isn't going any fucking where?

                                                                    Both your hide and show links are visible the whole time.
                                                                    My hide/show buttons toggle.

                                                                    You forgot to put your style sheet inside a style tag.

                                                                    z-index:999999???? Only if you don't know what's on your own web page.

                                                                    You use the script tag without specifying the script type.

                                                                    Your code doesn't even work unless you use use the jquery library, but
                                                                    my code is self contained, freestanding and works in all browsers.
                                                                    Anybody can use my code without doing anything extra.

                                                                    You didn't include the code to access jquery in your example :
                                                                    (<script type="text/javascript" src="jquery.js"></script>)

                                                                    Also of note is that you say my code is out of date, but my code is exactly the same javascript as what's inside of jquery.
                                                                    So jquery code is out of date too I guess.


                                                                    Here is the latest jquery source code : (all 175K of it )

                                                                    http://ooaz.com/gfy/jquery-latest.txt



                                                                    Jquery is for people who need help writing javascript code.

                                                                    And last but not least, you didn't bother to make a better tutorial, just
                                                                    sitting there all day trying to pick other people's code apart.
                                                                    And you failed at that.

                                                                    My conclusion is that jealousy sucks dude. Get a life.


                                                                    Comment

                                                                    • fris
                                                                      Too lazy to set a custom title
                                                                      • Aug 2002
                                                                      • 55679

                                                                      #35
                                                                      here is a good example

                                                                      http://fris.net/labs/sticky/
                                                                      Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                                                                      Comment

                                                                      • plsureking
                                                                        bored
                                                                        • Aug 2003
                                                                        • 4904

                                                                        #36
                                                                        save yourself the trouble:
                                                                        http://www.wibiya.com/
                                                                        PornCMS / low cost paysite management with hosting

                                                                        Comment

                                                                        • fris
                                                                          Too lazy to set a custom title
                                                                          • Aug 2002
                                                                          • 55679

                                                                          #37
                                                                          Originally posted by NaughtyRob
                                                                          Good way to put ad banners that the surfer can close if they are annoyed. I like it.
                                                                          this jquery plugin is good for that

                                                                          http://meerkat.jarodtaylor.com/demo/basic-usage/
                                                                          Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                                                                          Comment

                                                                          • 2012
                                                                            So Fucking What
                                                                            • Jul 2006
                                                                            • 17189

                                                                            #38
                                                                            excellent work sir, your CSS is fun to read

                                                                            best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

                                                                            Comment

                                                                            • sortie
                                                                              Confirmed User
                                                                              • Mar 2007
                                                                              • 7771

                                                                              #39
                                                                              Originally posted by fris
                                                                              here is a good example

                                                                              http://fris.net/labs/sticky/
                                                                              I like that.

                                                                              Keep in mind that this thread was only meant to show a very easy way to do it yourself.

                                                                              I had no plans to even add any code beside the first post and did the rest on the fly.

                                                                              I'm not trying to sell this.

                                                                              Question : Does using jquery take more bandwidth since it's "src"ed in?
                                                                              Answer : yes.

                                                                              So the webmaster is paying for using jquery instead of the small amount of code I use.

                                                                              They are serving up 175k of jquery code for every surfer but probably only
                                                                              using 2k of the 175k to actually do anything.

                                                                              Some people pull jquery from google to save bandwidth.

                                                                              http://perishablepress.com/press/200...libraries-api/

                                                                              Comment

                                                                              • sortie
                                                                                Confirmed User
                                                                                • Mar 2007
                                                                                • 7771

                                                                                #40
                                                                                Originally posted by 2012
                                                                                excellent work sir, your CSS is fun to read

                                                                                WTF!!

                                                                                Comment

                                                                                • Paul&John
                                                                                  Confirmed User
                                                                                  • Aug 2005
                                                                                  • 8643

                                                                                  #41
                                                                                  Looks awesome, thanks for sharing
                                                                                  Use coupon 'pauljohn' for a $1 discount at already super cheap NameSilo!
                                                                                  Anal Webcams | Kinky Trans Cams Live | Hotwife XXX Tube | Get your Proxies here

                                                                                  Comment

                                                                                  • Zorgman
                                                                                    Confirmed User
                                                                                    • Aug 2002
                                                                                    • 6103

                                                                                    #42
                                                                                    I tried this for my iphone website but the bottom is only on the first page. Might there be a fix for that?
                                                                                    ---

                                                                                    Comment

                                                                                    • selena
                                                                                      Confirmed User
                                                                                      • Aug 2004
                                                                                      • 7994

                                                                                      #43
                                                                                      Bookmarking thread for future use. I would give you rep if I could, and I think rep is stupid. ;)

                                                                                      Much thanks!
                                                                                      ~
                                                                                      Doer of Things at
                                                                                      MetArtMoney
                                                                                      Where Flawless Beauty Meets Art
                                                                                      ~The MetArt Network ~
                                                                                      selena.delgado9

                                                                                      Comment

                                                                                      • docputer
                                                                                        Confirmed User
                                                                                        • Jun 2006
                                                                                        • 1103

                                                                                        #44
                                                                                        Thank you. As others have said, if I could give you rep, you would have some more.

                                                                                        Comment

                                                                                        • dready
                                                                                          Confirmed User
                                                                                          • Oct 2002
                                                                                          • 5247

                                                                                          #45
                                                                                          Great post!
                                                                                          ICQ: 91139591

                                                                                          Comment

                                                                                          • NaughtyRob
                                                                                            Two fresh affiliate progs
                                                                                            • Nov 2004
                                                                                            • 29602

                                                                                            #46
                                                                                            Very nice.

                                                                                            Originally posted by fris
                                                                                            here is a good example

                                                                                            http://fris.net/labs/sticky/
                                                                                            [email protected]
                                                                                            Skype: 17026955414
                                                                                            Vacares Web Hosting - Protect Your Ass with Included Daily Backups

                                                                                            Comment

                                                                                            • Dirty Dane
                                                                                              Sick Fuck
                                                                                              • Feb 2004
                                                                                              • 9491

                                                                                              #47
                                                                                              div id with position:absolute works too.

                                                                                              In CSS:

                                                                                              body {margin: 0;}
                                                                                              #bottom {position:absolute; width:100%; bottom:0;}

                                                                                              In HTML:

                                                                                              <div id="bottom"> your spam here </div>

                                                                                              The absolute will ignore other elements.
                                                                                              Last edited by Dirty Dane; 10-20-2010, 08:48 AM.

                                                                                              Comment

                                                                                              • IllTestYourGirls
                                                                                                Ah My Balls
                                                                                                • Feb 2007
                                                                                                • 14311

                                                                                                #48
                                                                                                Originally posted by fris
                                                                                                here is a good example

                                                                                                http://fris.net/labs/sticky/
                                                                                                I would love something like this.

                                                                                                Comment

                                                                                                • sortie
                                                                                                  Confirmed User
                                                                                                  • Mar 2007
                                                                                                  • 7771

                                                                                                  #49
                                                                                                  Originally posted by Zorgman
                                                                                                  I tried this for my iphone website but the bottom is only on the first page. Might there be a fix for that?
                                                                                                  Maybe I don't quite get what you are asking because the code only
                                                                                                  works on the page that it is on; so clicking to the second page will
                                                                                                  mean the bottom is not there unless you add the code to that page.

                                                                                                  Package the script and html elements in a .js file then rel link to .js on
                                                                                                  all pages you want the bottom.

                                                                                                  Doing that in this example would have been too confusing I think.

                                                                                                  Comment

                                                                                                  • tonyparra
                                                                                                    Confirmed User
                                                                                                    • Jul 2008
                                                                                                    • 4568

                                                                                                    #50
                                                                                                    Fresh off bannage with already more rep than me

                                                                                                    High Performance Vps $10 Linode
                                                                                                    Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot

                                                                                                    Comment

                                                                                                    Working...