Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function initProductLogic() {
- //Слайдер - товар
- var imagesSlider = new Swiper(".slider_box .gallery-top", {
- nextButton: ".gallery-top .swiper-button-next",
- prevButton: ".gallery-top .swiper-button-prev",
- pagination: ".gallery-top .swiper-pagination",
- paginationClickable: true,
- loop: true,
- loopedSlides: 0,
- slidesPerView: 1,
- onInit : function () {
- $(".left_card_main .swiper-container img").each(function (index, element) {
- var img = $(element),
- parent = img.parent();
- parent
- .on("mouseenter", function () {
- parent.css({"height" : parent.outerHeight()});
- img.addClass("zoomed");
- })
- .mousemove(function (e) {
- var parentHeight = parent.outerHeight(),
- imgHeight = img.innerHeight(),
- i = (imgHeight - parentHeight) / parentHeight,
- y = e.clientY - parent.offset().top;
- img.css({
- top: -(y * i)
- });
- })
- .on("mouseleave", function () {
- img.removeClass("zoomed");
- });
- });
- },
- onSlideChangeStart: function (swiper) {
- $('.nav-link').removeClass('active');
- var currentIndex = swiper.realIndex;
- $('.nav-link:nth-child(' + (currentIndex + 1) + ')').addClass('active');
- }
- });
- $(".nav-link").on('click', function () {
- imagesSlider.slideTo($(this).index() + 1);
- $(".nav-link").removeClass('active');
- $(this).addClass('active');
- return false
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement