Hey all,
I was working on a slider using an unordered list. Standard structure, example (not the same code I'm using):
<div style="overflow: hidden;width: 500px;padding: 20px;position: relative">
<ul style="width: 1000px;position: relative;padding: 0;margin: 0;list-style: none;">
<li style="width: 500px;padding: 0;margin: 0;float: left;"></li>
<li style="width: 500px;padding: 0;margin: 0;float: left;"></li>
</ul>
</div>
using an li
width of 500px
and a div padding of 20px
plus the width of 500px
for example.
And some jQuery like:
$(div ul).animate({left: position.left-500+"px"});
I noticed by accident through my mistake that the jQuery when sliding the ul left only would slide it 460px
in this case. It seems that it is minusing the padding off automatically? And therefore the slided <ul>
is off every time.
Any explanation as to why this is happening?