Monday, 10 May 2010 17:35

As part of my site relaunch, I needed to rewrite a couple of things using jQuery instead of Mootools. One of these things is the Man Page footer at the bottom of the site. Rewriting it using jQuery actually ended up being fairly easy.

I'm not planning on incorporating this into the codebase of JMan, but I figured I'd share it nonetheless. So, here's a simple rewrite of JMan using nothing but jQuery:

(function($){
  $(document).ready(function(){
    function ManHandler(){
      var pct = Math.round(($(window).height()+$(window).scrollTop())/$(document).height()*100);
      $('#mantext').text(100 > pct ? '--More--('+pct+'%)' : '(END)');
    }
    $('<span id="mantext"></span>').appendTo($(document.body)).css({
      'display':'block',
      'opacity': 0.8,
      'position':'fixed',
      'bottom':'0px',
      'left':'0px',
      'z-index':5,
      'font-size':'0.8em',
      'font-weight':'bold',
      'background-color':'#000000',
      'color':'#FFFFFF',
      'width':'120px',
      'text-align':'center',
      'cursor':'default'
    });
    ManHandler();
    setInterval(ManHandler, 200);
  });
})(jQuery);
 

Add your comment

Your name:
Comment:
  The word for verification. Lowercase letters only with no spaces.
Word verification:

The Joomla!® name is used under a limited license from Open Source Matters in the United States and other countries. Jeff Channell is not affiliated with or endorsed by Open Source Matters or the Joomla!® Project.

Santorum
Joomla Extensions