what the blog?

{upgrade in progress..}

jQuery imgpreview undefined object issue

When the imgpreview.js and the loader script load in every page header, sometime maybe your page didn’t have any image class for display a image preview. A warning or error message will appear in your browser. How to avoid the error?

Open imgpreview.js

Append the code.

 
if (!h.length) return this;

after this line

h = this.filter(':linkingToImage(' + b.srcAttr + ')');

Look like

h = this.filter(':linkingToImage(' + b.srcAttr + ')');if (!h.length) return this;

loader.js loader script example.

var $imgprv = jQuery.noConflict();
$imgprv(document).ready(function() {
    $imgprv('.pic a').imgPreview({
    containerID: 'imgPreviewWithStyles',
    srcAttr: 'rel',
    imgCSS: {

    },
    onHide: function(link){
        $imgprv('span', this).remove();
    }
        });
});

http://james.padolsey.com/javascript/new-jquery-plugin-imgpreview/

java

levin • December 29, 2009


Previous Post

Next Post

Leave a Reply