Skip to main content

Bug Tracker

Side navigation

#4610 closed bug ()

Opened April 29, 2009 10:48PM UTC

Closed November 11, 2010 11:09PM UTC

Image width calculation

Reported by: WorldWideWebb Owned by:
Priority: minor Milestone: 1.3.2
Component: core Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

Sorry that my debugging skills may not be up to par, but I think I may have come across a small glitch in how image widths are calculated. Part of my script includes functionality to iterate over a ul, find the images in each li (one image per li), and add their widths to a variable that keeps track of the sum. I originally had an anchor link around each image, but the moment that I removed those anchor links, the calculation screws up. Hopefully this is just operator error. Portion of the script is as follows:

window.onload = function () {

var totalItemWidth = 0;

var firstItemWidth = $("#productListing img:first-child").width();

var lastItemWidth = $("#productListing img:last-child").width();

$("#productListing img").each(function (i) {

totalItemWidth = $(this).width() + totalItemWidth;

});

$("#productListing").css("width", totalItemWidth);

$("#productListing").css("left", (890 - totalItemWidth)/2);

var container = $('div.productSlider');

var ul = $('ul', container);

//var itemsWidth = ul.innerWidth() - container.outerWidth();

$('.slider', container).slider({

min: 0 - firstItemWidth - 20,

max: totalItemWidth - 680,

value: ((0 - firstItemWidth - 20) + (totalItemWidth - 680))/2,

handle: '.ui-slider-handle',

stop: function (event, ui) {

ul.animate({'left' : ui.value * -1}, 500);

},

slide: function (event, ui) {

ul.css('left', ui.value * -1);

}

});

...............

HTML is as follows:

<div id="container">

<div class="productSlider">

<ul id="productListing">

<li><a href="#"><img src="images/test_image_large.png" title="The image title" alt="The image title" border="0" /></a></li>

<li><a href="#"><img src="images/test_image_large.png" title="The image title" alt="The image title" border="0" /></a></li>

...............

Attachments (0)
Change History (3)

Changed May 04, 2009 12:21AM UTC by dmethvin comment:1

There is quite a bit of code there, so it's not clear where the problem lies. Can you create a simple test case that shows the problem you are encountering? It's best to work these out with a co-worker or on the forums before opening a bug report.

Changed October 14, 2010 03:14AM UTC by snover comment:2

status: newpending

This ticket has been marked as missing a test case. In an effort to reduce the number of outstanding tickets in the bug tracker, it will be closed automatically in 30 days. In order to prevent this from happening, please provide a working test case. If a test case has already been provided and our records are wrong, please respond to the ticket so that it can be fixed. Thank you!

Changed November 11, 2010 11:09PM UTC by trac-o-bot comment:3

status: pendingclosed

Automatically closed due to 14 days of inactivity.