Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery horizontal ui scroll not calculating outerWidth in Chrome
    primarykey
    data
    text
    <p>I'm having a problems to make a jQuery horizontal ui scrollbar work in Chrome. It works just fine in FireFox and even IE, but in Chrome I simply can't make it calculate the correct width of my "content" area. The "container" has a 920px fixed width, so no problem with that, but my "content" is, "on this page", exactly 4983px wide but when calculating with outerWidth() and even outerWidth(true), it will return a nonsense value that's a lot smaller than it should be! <a href="http://sites.publishyours.com.br/silviamecozzi/pt/obra/deserto_das_palmas.php" rel="nofollow">Here's the link to the page I'm working on</a>. <br /><br /></p> <p>And here's the code I have until now. It's a mess because I'm still working and doing some tests...</p> <pre><code> var container = $('.gallery'); var content = $('.content', container); var itemsWidth = content.outerWidth(true) - container.width(); var width = 0; $('figure').each(function() { width += $(this).width(); }); console.log('I dont know if I chose width: ' + width); console.log('Or if I chose itemsWidth: ' + itemsWidth); console.log('Actually, none of them is working on Chrome/webkit browsers'); $('.slider', container).slider({ min: 0, max: itemsWidth - 20, stop: function(event, ui){ content.animate({ 'margin-left' : ui.value * -1}, 500); }, slide: function(event, ui){ console.log(ui.value); content.css('margin-left',ui.value * -1); } }); </code></pre> <p>Notice that I'm trying to calculate the width value in two different ways: itemsWidth (var) and width (var). None of them work. Strange thing is... if you keep refreshing the browser (Chrome), it will eventually grab the correct width of the "content", but it's like once in every 10&ndash;15 tries =\</p> <p>It seems to be a Chrome/Webkit bug, but I have no idea about how to solve that! Thanks for your time and help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload