0
//Shows automatically the width and height from images
                $(document).ready(function () {
                    //Select all the images on the page
                    var img = $("#resultsFromSearch3").find('.oa-panels-col-33').find('img');
                    //For every image the code below will run 
                    $(img).each(function() {
                        //The code below select the p that belongs to the image. 
                        var description = $(this).closest('.oa-panels-row').find('.views-field-file-field-oa-body-value .field-content p:last-child');
                        //Create a new img element with the src of the orinial image. 
                        $("<img>").attr("src",$(this).attr('src')).load(function () {
                            //Print the width and height, of this clone image, in the description of the orinial image. 
                            description.after('<b>'+'Width=' + '</b>' +  this.width + 'px '+ '<br>' + '<b>'+'Height='+'</b>'+  this.height + 'px' + '<br>');
                        });
                    });
                });

I want to display the original image size on my screen in a list. Now it shows the width en height of the thumbnails. Anyone familiar?

1 Answers1

0

From this, from what I can see without looking too much into it, I can see you will probably get a error in your Chrome Dev tools console saying $ is not defined. Unless I'm getting it wrong (you may have one Js file and already have $ defined as Jquery) but you may have to write:

jQuery(document).ready(function($){
enter code here
}

From this you can see I only added the $ inside the document.ready function, but like I say you may have that defined somewhere else in the file ( above what is shown ) but if not this may fix your issue.

Sam Ryan
  • 7
  • 5