Фиксация Фото
#1
Отправлено 22 Февраль 2015 - 16:27
#2
Отправлено 24 Февраль 2015 - 20:35
#3
Отправлено 25 Февраль 2015 - 01:34
.product-shop .col-sm-7.col-md-7 { height: 400px; overflow-y: scroll; }
#4
Отправлено 25 Февраль 2015 - 17:18
Vaccina (25 Февраль 2015 - 01:34) писал:
.product-shop .col-sm-7.col-md-7 { height: 400px; overflow-y: scroll; }
Немного не то, насколько я понимаю, здесь http://pyjama-party....-printom-61066/
до определенного момента фото фиксировано, а потом останавливается.
Это можно как-нибудь увязать в JS как верхнюю шапку, т.е. с определенного момента она начинается фиксироваться, а потом перестает фиксироваться?
Может там весь левый блок зафиксировать?
#5
Отправлено 01 Март 2015 - 02:31
#6
Отправлено 05 Март 2015 - 00:44
#7
Отправлено 06 Март 2015 - 20:46
#8
Отправлено 07 Март 2015 - 01:14
$(function() { if ($('.image-box').length) { var imgBox = $('.image-box'), imgHeight = imgBox.height(), offsetInner = $('.header').height(), offsetTop = imgBox.offset().top - offsetInner + 20, offsetBottom = $('.product-tab').offset().top - imgHeight - 60; $(window).scroll(function() { var offset = $(this).scrollTop(); if (offset > offsetTop && offset < offsetBottom) { imgBox.css({'position': 'fixed', 'top': 120}); return; } else if(offset >= offsetBottom) { imgBox.css({'position': 'absolute', 'top': (offsetBottom + 60) - imgHeight + offsetInner}); return; } imgBox.css({'position': 'relative', 'top': 0}); }); } });
#9
Отправлено 07 Март 2015 - 22:17
Vaccina (07 Март 2015 - 01:14) писал:
$(function() { if ($('.image-box').length) { var imgBox = $('.image-box'), imgHeight = imgBox.height(), offsetInner = $('.header').height(), offsetTop = imgBox.offset().top - offsetInner + 20, offsetBottom = $('.product-tab').offset().top - imgHeight - 60; $(window).scroll(function() { var offset = $(this).scrollTop(); if (offset > offsetTop && offset < offsetBottom) { imgBox.css({'position': 'fixed', 'top': 120}); return; } else if(offset >= offsetBottom) { imgBox.css({'position': 'absolute', 'top': (offsetBottom + 60) - imgHeight + offsetInner}); return; } imgBox.css({'position': 'relative', 'top': 0}); }); } });
Спасибо огромное!!! Но есть одно но, фотографии как бы скачут, когда пролистываешь до конца или до верху.
Прикрепленные файлы
#10
Отправлено 11 Март 2015 - 06:06
offsetInner = $('.header').height(),
на
offsetInner = 160,
а после изменить 160 на другое значение большее или меньшее, для улучшения плавности прокрутки.
#11
Отправлено 13 Март 2015 - 23:19
Vaccina (11 Март 2015 - 06:06) писал:
offsetInner = $('.header').height(),
на
offsetInner = 160,
а после изменить 160 на другое значение большее или меньшее, для улучшения плавности прокрутки.
Спасибо!
1) но все еще-то фото не прыгает, а где-то прыгает, как исправить? и ещё, как сделать, чтобы опускалось ниже, к примеру здесь? http://dochkam-sinoc...ki-2#show_tab_1
2) когда размер экрана меньше 1300, то происходит такая лабуда:
#12
Отправлено 17 Март 2015 - 23:44
#13
Отправлено 19 Март 2015 - 16:21
tolikkansk (13 Март 2015 - 23:19) писал:
1) но все еще-то фото не прыгает, а где-то прыгает, как исправить? и ещё, как сделать, чтобы опускалось ниже, к примеру здесь? http://dochkam-sinoc...ki-2#show_tab_1
2) когда размер экрана меньше 1300, то происходит такая лабуда:
Жду ответа на мой вопрос.....
#14
Отправлено 23 Март 2015 - 14:34
#15
Отправлено 31 Март 2015 - 19:51
#16
Отправлено 04 Апрель 2015 - 03:39
$(function() { if ($('.image-box').length) { var imgBox = $('.image-box'), imgHeight = imgBox.height(), offsetInner = 160, offsetTop = imgBox.offset().top - offsetInner + 20, offsetBottom = $('.product-tab').offset().top - imgHeight - 60; $(window).scroll(function() { var offset = $(this).scrollTop(); if (offset > offsetTop && offset < offsetBottom) { imgBox.css({'position': 'fixed', 'top': 120}); return; } else if(offset >= offsetBottom) { imgBox.css({'position': 'absolute', 'top': (offsetBottom + 60) - imgHeight + offsetInner}); return; } imgBox.css({'position': 'relative', 'top': 0}); }); } });
замените на:
$(function() { if ($('.image-box').length && $(window).width() > 960) { var imgBox = $('.image-box'), imgHeight = imgBox.height(), offsetInner = 40, offsetTop = imgBox.offset().top - offsetInner + 20, offsetBottom = $('.product-tab').offset().top - imgHeight - 60; $(window).scroll(function() { var offset = $(this).scrollTop(); if (offset > offsetTop && offset < offsetBottom) { imgBox.css({'position': 'fixed', 'top': 120}); return; } else if(offset >= offsetBottom) { imgBox.css({'position': 'absolute', 'top': (offsetBottom + 60) - imgHeight + offsetInner}); return; } imgBox.css({'position': 'relative', 'top': 0}); }); } });
Количество пользователей, читающих эту тему: 0
0 пользователей, 0 гостей, 0 анонимных