Merge branch 'ticket-8048' into develop

This commit is contained in:
Marion Muszynski 2016-09-28 15:05:33 +02:00
commit 9cdc7edb8a

View File

@ -45,20 +45,25 @@ $(document).ready(function(){
var frame = $('#privatesales_similarproduct .slider_sales_product_footer');
var list_items = frame.find('ul');
var nb_items = list_items.find('li').length;
if (nb_items>3) {
// 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,
@ -76,12 +81,12 @@ $(document).ready(function(){
// outWidth is supposed to include margin... However sometimes only margin width is return...
if (item.outerWidth(true) < item.outerWidth(false)) {
item_width = item.outerWidth(false);
item_width = item.outerWidth(false);
margin_width = item.outerWidth(true);
item_width += margin_width;
}
else {
item_width = item.outerWidth(true);
item_width = item.outerWidth(true);
margin_width = 0;
}
@ -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;
}
});