topical media & game development

talk show tell print

lib-jquery-plugin-layers-includes-jquery.background-layers.js / js



  

author: Terry Wooton @desc Adds a background layer to an element
version: 1.1 @example $("#element").add_background("url('/test.gif') bottom left no-repeat"); @license free
parameter: background css

  
  document.ready(function() {
    .fn.add_layer = function(bg,params) {
      this.each(function() {
    
        s = this.extend({},params || {});      
        
        last = (this.find('.add_background:last').length > 0 ? this.find('.add_background:last') : this);
                    last.html('<div class="add_background"><div>'+last.html()+'</div></div>');
                    last = this.find('.add_background:last');
                    last.css({'background':bg,'width':'100%','height':'100%'});
  
        last = this.find('.add_background div:last');
              
        if(s.insideCss){
                       last.css(s.insideCss);
                    }
        if(s.insideClass)
                      last.addClass(s.insideClass);                    
      });
    }      
  });


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.