fix js slider

This commit is contained in:
Marion Muszynski 2016-09-28 15:05:05 +02:00
parent da5a017c06
commit e7d82a7a30

View File

@ -51,14 +51,19 @@ $(document).ready(function(){
// adjust css
frame.css({
'overflow': 'hidden',
'margin-left':'40px',
'width':'800px'
'margin-left':'51px',
'width':'800px',
});
list_items.css({
'padding-left':'10px',
});
list_items.find('li').css({
'width':'267px'
'width':'252px',
'margin-left':'0px',
});
list_items.find('li').find('.similar_product').css({
'width':'auto',
});
// prepare parameters
var animation_options = {
'duration':500,
@ -94,7 +99,7 @@ $(document).ready(function(){
frame.find('.ico_prev')
.css({
'position':'absolute',
'left':'-10px',
'left':'0px',
'top':'100px',
'z-index':'10'
})
@ -103,7 +108,7 @@ $(document).ready(function(){
})
.click(function(ev){
if (state_scroll.cpt_item>0) {
list_items.animate({'left':'+='+item_width*state_scroll.step}, animation_options);
list_items.animate({'left':'+='+(10+item_width*state_scroll.step)}, animation_options);
state_scroll.cpt_item -= state_scroll.step;
}
});
@ -111,7 +116,7 @@ $(document).ready(function(){
frame.find('.ico_next')
.css({
'position':'absolute',
'right':'10px',
'right':'0px',
'top':'100px',
'z-index':'10'
})
@ -119,8 +124,9 @@ $(document).ready(function(){
$(ev.target).css('cursor', 'pointer');
})
.click(function(ev){
console.log(item_width*state_scroll.step);
if (state_scroll.cpt_item<(state_scroll.nb_items-state_scroll.step)) {
list_items.animate({'left':'-='+item_width*state_scroll.step}, animation_options);
list_items.animate({'left':'-='+(10+item_width*state_scroll.step)}, animation_options);
state_scroll.cpt_item += state_scroll.step;
}
});