Menu

#1 Support for Chrome 5.0and FF 3.6

Unstable (example)
open
nobody
None
5
2010-08-12
2010-08-12
Hansson
No

It is quite few changes:

/*
* Shim jQuery Plug-in jqRevision: 3 jq
* <https://sourceforge.net/projects/jqueryshim>
*
* Copyright (c) 2010 Dave Willkomm
* Licensed under the MIT License
* <http://www.opensource.org/licenses/mit-license.php>
*
* Patched to work in Chrome 5.0 and FF 3.6.8 by Jesper Hansson, Grontmij | Carl Bro
*/
(function(jq) {

jq.fn.shim = function()
{
this.each(function()
{
var bgc = (jq.browser.mozilla) ? 'white' : 'none';
var element = jq(this),
offset = element.offset(),
html = '<iframe class="shim" frameborder="0" style="' +
'display: block;'+
'background-color: ' + bgc + ';' +
'position: absolute;' +
'top:' + offset.top + 'px;' +
'left:' + offset.left + 'px;' +
'width:' + element.outerWidth() + 'px;' +
'height:' + element.outerHeight() + 'px;' +
'z-index:' + (Number(element.css('z-index')) - 1) + ';' +
'"/>';
element.before(html);
});

return this;
};

jq.fn.unshim = function()
{
this.each(function()
{
jq(this).prev("iframe.shim").remove();
});

return this;
};

})(jQuery);

Discussion

  • Hansson

    Hansson - 2010-08-12

    /*
    * Shim jQuery Plug-in jqRevision: 3 jq
    * <https://sourceforge.net/projects/jqueryshim>
    *
    * Copyright (c) 2010 Dave Willkomm
    * Licensed under the MIT License
    * <http://www.opensource.org/licenses/mit-license.php>
    *
    * Patched 12/8-2010 to work in Chrome 5.0 and FF 3.6.8 by Jesper Hansson, Grontmij | Carl Bro
    * Also resolved problems with shimming inside nested divs.
    * Only one shimmer per element will be inserted.
    */
    (function(jq) {

    jq.fn.shim = function()
    {
    this.each(function()
    {
    var element = jq(this),
    id = (element.attr('id') == '') ? 'shimGenId' + Math.floor(Math.random()*4294967296) : element.attr('id');
    if (jq('#shimmer_' + jq(this).attr('id')).size() == 0) {
    var bgc = (jq.browser.mozilla) ? 'white' : 'none',
    offset = element.offset(),
    html = '<iframe class="shim" frameborder="0" id="shimmer_' + id + '"style="' +
    'display: block;'+
    'background-color: ' + bgc + ';' +
    'position: absolute;' +
    'top:' + offset.top + 'px;' +
    'left:' + offset.left + 'px;' +
    'width:' + element.outerWidth() + 'px;' +
    'height:' + element.outerHeight() + 'px;' +
    'z-index:' + (Number(element.css('z-index')) - 1) + ';' +
    '"/>';
    element.attr('id', id);
    jq('body').append(html);
    }
    });

    return this;
    };

    jq.fn.unshim = function()
    {
    this.each(function()
    {
    jq('#shimmer_' + jq(this).attr('id') ).remove() ;
    });

    return this;
    };

    })(jQuery);

     
  • Hansson

    Hansson - 2010-08-12

    in a file

     
  • Hansson

    Hansson - 2010-08-12

    Now with reshim when calling shim. Very convinient when resizing window.

    /*
    * Shim jQuery Plug-in jqRevision: 3 jq
    * <https://sourceforge.net/projects/jqueryshim>
    *
    * Copyright (c) 2010 Dave Willkomm
    * Licensed under the MIT License
    * <http://www.opensource.org/licenses/mit-license.php>
    *
    * Patched 12/8-2010 to work in Chrome 5.0 and FF 3.6.8 by Jesper Hansson, Grontmij | Carl Bro
    * Also resolved problems with shimming inside nested divs.
    * Max one shimmer per element will be inserted - otherwise it will be reshimmed.
    */
    (function(jq) {

    jq.fn.shim = function()
    {
    this.each(function()
    {
    var element = jq(this),
    id = (element.attr('id') == '') ? 'shimGenId' + Math.floor(Math.random()*4294967296) : element.attr('id');
    if (jq('#shimmer_' + jq(this).attr('id')).size() > 0)
    jq('#shimmer_' + jq(this).attr('id') ).remove() ;
    var bgc = (jq.browser.mozilla) ? 'white' : 'none',
    offset = element.offset(),
    html = '<iframe class="shim" frameborder="0" id="shimmer_' + id + '"style="' +
    'display: block;'+
    'background-color: ' + bgc + ';' +
    'position: absolute;' +
    'top:' + offset.top + 'px;' +
    'left:' + offset.left + 'px;' +
    'width:' + element.outerWidth() + 'px;' +
    'height:' + element.outerHeight() + 'px;' +
    'z-index:' + (Number(element.css('z-index')) - 1) + ';' +
    '"/>';
    element.attr('id', id);
    jq('body').append(html);
    });

    return this;
    };

    jq.fn.unshim = function()
    {
    this.each(function()
    {
    jq('#shimmer_' + jq(this).attr('id') ).remove() ;
    });

    return this;
    };

    })(jQuery);

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.