0

Resource:

Карточки товара

let product     = $('.product');
  let productLink = product.find('.product__link');
  let productFrame = product.find('.product__frame');
  let productImages = product.find('.product__images');

  product.on('mouseover', function () {

    productLink.html('detail').addClass('visible');
    productFrame.addClass('active');
    productImages.addClass('hidden');

  });

  product.on('mouseout', function () {

    productLink.html('').removeClass('visible');
    productFrame.removeClass('active');
    productImages.removeClass('hidden');

  });

Summary:

В этой верстке есть карточки товара, к которым надо применить анимацию. Когда наводится курсор на карточку товара, почему-то она применяется для всех. Пытался циклом пройтись, все равно jq ругается. Порылся в инете предлагают через each(). Но не разобрался!

Question: Как же тогда пройтись с помощью цикла и сделать контекст для определенного элемента в jq (чтобы только в одной карточке срабатывала анимация) ?? Возможно есть другие способы??

5

2 ответа 2

1

Вариант с jQuery:

$('.product')
    .on('mouseover', function (event) {
      $(this).find('.product__link').html('detail').addClass('visible');
      $(this).find('.product__frame').addClass('active');
      $(this).find('.product__images').addClass('hidden');
    })
    .on('mouseout', function (event) {
      $(this).find('.product__link').html('').removeClass('visible');
      $(this).find('.product__frame').removeClass('active');
      $(this).find('.product__images').removeClass('hidden');
 });

codepen

3
  • Благодарю Вас! Буду детально разбирать
    – John
    29 июн 2019 в 8:05
  • а event для чего?
    – John
    29 июн 2019 в 8:08
  • Аргумент event ф-и обработчика, в этом коде, не используется. Но если бы, потребовалась дополнительная информация о событии, то ее можно получить у объекта event.
    – Jigius
    30 июн 2019 в 7:21
1

var target,
  productLink,
  productFrame,
  productImages;

document.body.addEventListener('mouseover', () => {
  target = event.target;

  while (target != document.body) {
    if (target.tagName == 'LI' && !target.classList.contains('title-link')){
      // нашли элемент, который нас интересует!
      productLink = target.querySelector('.product__link-wrap');
      productFrame = target.querySelector('.product__frame');
      productImages = target.querySelector('.product__images');

      productLink.classList.add('visible');
      productFrame.classList.add('active');
      productImages.classList.add('hidden');

      return;
    }

    target = target.parentNode;
  }
})

document.body.addEventListener('mouseout', () => {

  if (target.tagName == 'LI' && !target.classList.contains('title-link')) {
    productLink.classList.remove('visible');
    productFrame.classList.remove('active');
    productImages.classList.remove('hidden');
  }

})
html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%
}

body {
  margin: 0
}

details,
main {
  display: block
}

h1 {
  font-size: 2em;
  margin: .67em 0
}

hr {
  box-sizing: content-box;
  height: 0;
  overflow: visible
}

code,
kbd,
pre,
samp {
  font-family: monospace, monospace;
  font-size: 1em
}

a {
  background-color: transparent
}

abbr[title] {
  border-bottom: none;
  text-decoration: underline;
  text-decoration: underline dotted
}

b,
strong {
  font-weight: bolder
}

small {
  font-size: 80%
}

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline
}

sub {
  bottom: -.25em
}

sup {
  top: -.5em
}

img {
  border-style: none
}

button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  line-height: 1.15;
  margin: 0
}

button,
input {
  overflow: visible
}

button,
select {
  text-transform: none
}

[type=button],
[type=reset],
[type=submit],
button {
  -webkit-appearance: button
}

[type=button]::-moz-focus-inner,
[type=reset]::-moz-focus-inner,
[type=submit]::-moz-focus-inner,
button::-moz-focus-inner {
  border-style: none;
  padding: 0
}

[type=button]:-moz-focusring,
[type=reset]:-moz-focusring,
[type=submit]:-moz-focusring,
button:-moz-focusring {
  outline: ButtonText dotted 1px
}

fieldset {
  padding: .35em .75em .625em
}

legend {
  box-sizing: border-box;
  color: inherit;
  display: table;
  max-width: 100%;
  padding: 0;
  white-space: normal
}

progress {
  vertical-align: baseline
}

textarea {
  overflow: auto
}

[type=checkbox],
[type=radio] {
  box-sizing: border-box;
  padding: 0
}

[type=number]::-webkit-inner-spin-button,
[type=number]::-webkit-outer-spin-button {
  height: auto
}

[type=search] {
  -webkit-appearance: textfield;
  outline-offset: -2px
}

[type=search]::-webkit-search-decoration {
  -webkit-appearance: none
}

 ::-webkit-file-upload-button {
  -webkit-appearance: button;
  font: inherit
}

summary {
  display: list-item
}

[hidden],
template {
  display: none
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 200;
  font-style: normal;
  font-stretch: normal;
  src: url('../fonts/SourceSansPro-ExtraLight.ttf.woff2') format('woff2'), url('../fonts/SourceSansPro-ExtraLight.otf.woff') format('woff'), url('../fonts/SourceSansPro-ExtraLight.otf') format('opentype'), url('../fonts/SourceSansPro-ExtraLight.ttf') format('truetype');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 300;
  font-style: normal;
  font-stretch: normal;
  src: url('../fonts/SourceSansPro-Light.ttf.woff2') format('woff2'), url('../fonts/SourceSansPro-Light.otf.woff') format('woff'), url('../fonts/SourceSansPro-Light.otf') format('opentype'), url('../fonts/SourceSansPro-Light.ttf') format('truetype');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 400;
  font-style: normal;
  font-stretch: normal;
  src: url('../fonts/SourceSansPro-Regular.ttf.woff2') format('woff2'), url('../fonts/SourceSansPro-Regular.otf.woff') format('woff'), url('../fonts/SourceSansPro-Regular.otf') format('opentype'), url('../fonts/SourceSansPro-Regular.ttf') format('truetype');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 600;
  font-style: normal;
  font-stretch: normal;
  src: url('../fonts/SourceSansPro-Semibold.ttf.woff2') format('woff2'), url('../fonts/SourceSansPro-Semibold.otf.woff') format('woff'), url('../fonts/SourceSansPro-Semibold.otf') format('opentype'), url('../fonts/SourceSansPro-Semibold.ttf') format('truetype');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 700;
  font-style: normal;
  font-stretch: normal;
  src: url('../fonts/SourceSansPro-Bold.ttf.woff2') format('woff2'), url('../fonts/SourceSansPro-Bold.otf.woff') format('woff'), url('../fonts/SourceSansPro-Bold.otf') format('opentype'), url('../fonts/SourceSansPro-Bold.ttf') format('truetype');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 900;
  font-style: normal;
  font-stretch: normal;
  src: url('../fonts/SourceSansPro-Black.ttf.woff2') format('woff2'), url('../fonts/SourceSansPro-Black.otf.woff') format('woff'), url('../fonts/SourceSansPro-Black.otf') format('opentype'), url('../fonts/SourceSansPro-Black.ttf') format('truetype');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 900;
  font-style: italic;
  font-stretch: normal;
  src: url('WOFF2/TTF/SourceSansPro-BlackIt.ttf.woff2') format('woff2'), url('WOFF/OTF/SourceSansPro-BlackIt.otf.woff') format('woff'), url('OTF/SourceSansPro-BlackIt.otf') format('opentype'), url('TTF/SourceSansPro-BlackIt.ttf') format('truetype');
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: #fff;
  font: normal 14px/24px "Source Sans Pro";
  text-transform: uppercase;
  letter-spacing: 1px;
}

ul,
li,
p,
h1,
h2,
h3,
h4 {
  padding: 0;
  margin: 0;
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  text-decoration: none;
}

* {
  box-sizing: border-box;
}

.container {
  max-width: 1180px;
  margin: auto;
  padding: 0 20px;
}

.container-wrap {
  max-width: 1610px;
  margin: auto;
  background-color: #fbfbfb;
}

.header__top {
  padding-top: 25px;
  padding-bottom: 20px;
}

.top-header {
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: justify;
  justify-content: space-between;
}

.top-header__text {
  color: #323232;
  font-size: 13px;
  line-height: 12px;
  padding-right: 10px;
}

.top-header__text:hover {
  color: #656565;
}

.top-header__text_bold {
  font-weight: 700;
  cursor: default;
}

.top-header__text_bold:hover {
  color: #323232;
}

.middle-header {
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: justify;
  justify-content: space-between;
  padding-top: 30px;
}

.middle-header__col-1 {
  max-width: 300px;
}

.middle-header__col-2 {
  margin-top: -50px;
}

.middle-header__col-3 {
  width: 420px;
}

.login__text {
  font-size: 13px;
  color: #656565;
  background-repeat: no-repeat;
  background-position: left;
  margin-bottom: 15px;
  padding-left: 25px;
  font-weight: 400;
  letter-spacing: 2px;
}

.login__text_white {
  background-color: #e1bc62;
  color: #fff;
  padding: 0 2px;
  font-weight: 600;
}

.login__text_white:hover {
  background-color: #e9ce8d;
}

.login__text_user {
  background-image: url('../img/user-icon.svg');
}

.login__text_phone {
  background-image: url('../img/phone-icon.svg');
  text-transform: capitalize;
}

.login__text_phone .phone-num {
  font-size: 15px;
}

.login__search input {
  width: 100%;
  padding: 15px 15px;
  background-repeat: no-repeat;
  background-image: url('../img/search-icon.svg');
  background-position: 95% 50%;
  border: 1px solid #bebebe;
}

.login__search input::-webkit-input-placeholder {
  text-transform: uppercase;
  color: #989898;
}

.login__search input::-moz-placeholder {
  text-transform: uppercase;
  color: #989898;
}

.login__search input:-ms-input-placeholder {
  text-transform: uppercase;
  color: #989898;
}

.login__search input::-ms-input-placeholder {
  text-transform: uppercase;
  color: #989898;
}

.login__search input::placeholder {
  text-transform: uppercase;
  color: #989898;
}

.sold__item {
  display: -webkit-box;
  display: flex;
}

.sold__item_top {
  font-size: 14px;
  color: #323232;
}

.sold__item_middle {
  border: 1px solid #ccc;
  border-top: 0;
  padding: 15px;
}

.sold__link {
  font-size: 14px;
  color: #323232;
  text-align: center;
  position: relative;
  padding: 15px 0;
}

.sold__link:hover {
  color: #656565;
}

.sold__link_wishlist {
  width: 180px;
  padding-left: 23px;
}

.sold__link_cart {
  -webkit-box-flex: 1;
  flex-grow: 1;
  padding-left: 15px;
}

.sold__link.active {
  border: 1px solid #ccc;
  border-bottom: 0 solid #ccc;
}

.sold__link .icon {
  width: 23px;
  height: 23px;
  background-repeat: no-repeat;
  display: inline-block;
  background-position: center;
  position: absolute;
}

.sold__link .icon_wishlist {
  background-image: url('../img/wishlist.png');
  left: 30px;
}

.sold__link .icon_cart {
  background-image: url('../img/cart-icon.png');
  left: 15px;
}

.sold__link .total-sum {
  color: #cd222a;
  font-weight: 900;
  letter-spacing: 1px;
  font-size: 13px;
}

.sold__link .total-sum_padding {
  padding-left: 57px;
}

.sold__link .amount {
  position: absolute;
  width: 18px;
  height: 18px;
  background-color: #cd222a;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  line-height: 18px;
  left: 9px;
  top: 9px;
}

.sold__product {
  -webkit-box-flex: 1;
  flex-grow: 1;
  position: relative;
}

.sold__product .delete {
  position: absolute;
  width: 12px;
  height: 12px;
  right: 20px;
  cursor: pointer;
  top: 50%;
  margin-top: -5px;
}

.sold__product .delete:before,
.sold__product .delete:after {
  content: '';
  position: absolute;
  display: block;
  width: 1.5px;
  height: 12px;
  background-color: #ccc;
  right: 50%;
  margin-right: -1px;
  -webkit-transform: rotate(35deg);
  -ms-transform: rotate(35deg);
  transform: rotate(35deg);
}

.sold__product .delete:after {
  -webkit-transform: rotate(-35deg);
  -ms-transform: rotate(-35deg);
  transform: rotate(-35deg);
}

.sold__title,
.sold__price {
  color: #656565;
  text-transform: uppercase;
}

.sold__title {
  font-weight: 700;
  font-size: 12px;
}

.sold__img {
  float: left;
  margin-right: 15px;
}

.sold__price {
  font-weight: 400;
  font-size: 16px;
  line-height: 18px;
}

.sold__btn {
  text-align: center;
  line-height: 16px;
  padding: 11px;
}

.sold__btn_first {
  -webkit-box-flex: 1;
  flex-grow: 1;
  background-color: #383739;
}

.sold__btn_first:hover {
  background-color: #525053;
}

.sold__btn_second {
  width: 180px;
  background-color: #e1bc62;
  position: relative;
}

.sold__btn_second:hover {
  background-color: #e9ce8d;
}

.sold__btn .text {
  color: #fff;
  font-weight: 600;
}

.sold__btn .plus {
  width: 12px;
  height: 12px;
  position: relative;
  display: inline-block;
  margin-right: 8px;
}

.sold__btn .plus:before,
.sold__btn .plus:after {
  content: '';
  position: absolute;
  display: block;
  background-color: #fff;
  height: 12px;
  width: 2px;
  right: 50%;
  margin-right: -0.5px;
}

.sold__btn .plus:after {
  -webkit-transform: rotate(90deg);
  -ms-transform: rotate(90deg);
  transform: rotate(90deg);
}

.sold__btn .checkout {
  background-image: url('../img/checkout-icon.svg');
  position: absolute;
  width: 24px;
  height: 24px;
  background-position: center;
  display: inline-block;
  background-repeat: no-repeat;
  left: 20px;
  top: 50%;
  margin-top: -12px;
}

.nav_margin {
  padding: 20px 0;
  position: relative;
}

.nav_margin:after {
  content: '';
  position: absolute;
  display: block;
  height: 5px;
  background-color: #e1bc62;
  width: 100%;
  bottom: 0;
  left: 0;
}

.nav-list {
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: center;
  justify-content: center;
}

.nav-list__item {
  margin-right: 28px;
  margin-left: 28px;
  line-height: 15px;
}

.nav-list__link {
  color: #444444;
  font-weight: 600;
  font-size: 15px;
  text-transform: uppercase;
}

.nav-list__link:hover {
  color: #777777;
}

.shop-window {
  display: -webkit-box;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  flex-direction: column;
  flex-wrap: wrap;
  -webkit-box-pack: start;
  justify-content: flex-start;
  align-content: flex-start;
  height: 680px;
  margin: -10px;
}

.shop-window_padding20px {
  padding-top: 20px;
}

.shop-window__col {
  margin: 10px;
  overflow: hidden;
  position: relative;
}

.shop-window__col img {
  display: block;
}

.shop-window__col_1 {
  height: 100%;
  width: calc(100% / 12 * 3 - 20px);
}

.shop-window__col_2 {
  height: calc(100% / 12 * 6 - 20px);
  width: calc(100% / 12 * 6 - 20px);
}

.shop-window__col_3 {
  height: calc(100% / 12 * 6 - 20px);
  width: calc(100% / 12 * 3 - 20px);
}

.shop-window__col_4 {
  height: calc(100% / 12 * 6 - 20px);
  width: calc(100% / 12 * 3 - 20px);
}

.shop-window__col_5 {
  background-color: black;
  height: calc(100% / 12 * 6 - 20px);
  width: calc(100% / 12 * 6 - 20px);
  margin-left: calc((100% / 12 * 3 - 10px)*-1);
}

.collections__wrap-img {
  position: relative;
}

.collections__wrap-img:before {
  content: '';
  position: absolute;
  display: block;
  background-color: #fff;
  z-index: 100;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  opacity: 0.4;
}

.collections__wrap-block {
  position: absolute;
  top: 60%;
  left: 0;
  width: 100%;
  text-align: center;
  z-index: 1000;
}

.collections__month {
  font-size: 36px;
  color: #000;
  letter-spacing: 2px;
}

.collections__month span {
  display: block;
  font-size: 12px;
  text-transform: capitalize;
  font-weight: 400;
  letter-spacing: 10px;
}

.collections__link {
  display: block;
  margin: auto;
  margin-top: 10px;
  padding: 15px;
  text-align: center;
  background: #e1bc62;
  width: 60%;
  font-size: 14px;
  line-height: 14px;
  text-transform: capitalize;
  color: #fff;
  font-weight: 700;
}

.collections__link:hover {
  background: #e9ce8d;
}

.sale {
  position: relative;
}

.sale__img {
  display: block;
}

.sale__sticker {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  width: 60px;
  height: 38px;
}

.sale__sticker:before {
  content: '';
  position: absolute;
  display: block;
  border-left: 25px solid transparent;
  border-bottom: 25px solid transparent;
  border-right: 25px solid #e1bc62;
  border-top: 25px solid #e1bc62;
  z-index: 200;
  -webkit-transform: rotate(-77deg);
  -ms-transform: rotate(-77deg);
  transform: rotate(-77deg);
  top: -18px;
  left: -1px;
}

.sale__text {
  color: #fff;
  letter-spacing: 5px;
  background-color: #e1bc62;
  position: absolute;
  z-index: 100;
  -webkit-transform: rotate(-32deg);
  -ms-transform: rotate(-32deg);
  transform: rotate(-32deg);
  top: 8px;
  line-height: 12px;
  width: 93px;
  box-shadow: 0 0 4px 1px black;
  text-align: center;
  left: -25px;
  font-size: 12px;
  padding-left: 4px;
}

.block-3__img {
  height: 100%;
}

.block-5__img {
  height: 100%;
}

.arrivals__wrap-img:before {
  content: '';
  position: absolute;
  display: block;
  background-color: #fff;
  z-index: 100;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  opacity: 0.4;
}

.arrivals__wrap-block {
  position: absolute;
  top: 35%;
  left: 0;
  width: 100%;
  text-align: center;
  z-index: 1000;
}

.arrivals__text {
  font-size: 32px;
  letter-spacing: 10px;
  font-weight: 100;
  text-align: center;
}

.arrivals__text span {
  font-size: 42px;
  font-weight: 900;
  display: block;
  text-align: center;
  letter-spacing: 1px;
}

.arrivals__link {
  display: block;
  margin: auto;
  margin-top: 10px;
  padding: 15px;
  text-align: center;
  background: #e1bc62;
  width: 60%;
  font-size: 14px;
  line-height: 14px;
  text-transform: capitalize;
  color: #fff;
  font-weight: 700;
}

.arrivals__link:hover {
  background: #e9ce8d;
}

.products_padding85 {
  padding-top: 90px;
}

.products_mod {
  display: -webkit-box;
  display: flex;
  flex-wrap: wrap;
  margin-right: -7px;
  margin-left: -7px;
}

.products__title {
  width: 100%;
  margin-bottom: 55px;
}

.products__item {
  width: calc(100% / 12 * 3 - 14px);
  margin-left: 7px;
  margin-right: 7px;
  display: -webkit-box;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  flex-direction: column;
  -webkit-box-align: center;
  align-items: center;
}

.title-link__titles {
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: center;
  justify-content: center;
  position: relative;
  margin-bottom: 30px;
}

.title-link__titles:before {
  content: '';
  position: absolute;
  display: block;
  width: 2px;
  height: 100%;
  background: #d6d6d6;
  right: 50%;
  margin-right: -4px;
}

.title-link__title {
  font-size: 48px;
  color: #595959;
  padding-right: 60px;
  line-height: 35px;
  position: relative;
  font-weight: 100;
  -webkit-transition: 1s;
  transition: 1s;
}

.title-link__title:hover .arrow {
  -webkit-transform: rotate(405deg);
  -ms-transform: rotate(405deg);
  transform: rotate(405deg);
}

.title-link__title.active {
  font-weight: 900;
  color: #000;
}

.title-link__title.active:hover {
  cursor: default;
}

.title-link__title.active:hover .arrow {
  -webkit-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  transform: rotate(45deg);
}

.title-link__title_second {
  margin-left: 15px;
}

.title-link__title .arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  border-right: 1px solid;
  border-bottom: 1px solid;
  right: 30px;
  top: 50%;
  margin-top: -6px;
  -webkit-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  transform: rotate(45deg);
  -webkit-transition: 1s;
  transition: 1s;
}

.title-link__advantages {
  text-align: center;
  color: #595959;
  letter-spacing: 2px;
  text-transform: initial;
  font-style: italic;
  line-height: 14px;
}

.product {
  position: relative;
}

.product div,
.product a {
  position: relative;
  z-index: 100;
}

.product:before {
  content: '';
  position: absolute;
  display: block;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #fff;
  z-index: 20;
}

.product__images {
  position: relative;
  display: block;
  margin-bottom: 15px;
}

.product__images:before {
  content: '';
  position: absolute;
  display: block;
  background-color: #fff;
  z-index: 1000;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  opacity: 0.4;
}

.product__images:after {
  content: '';
  position: absolute;
  display: block;
  width: 44px;
  height: 2px;
  right: 50%;
  margin-right: -22px;
  bottom: -7px;
  background-color: #595959;
}

.product__images.hidden:before {
  opacity: 0;
}

.product__image img {
  display: block;
  width: 100%;
  height: 290px;
}

.product__link-wrap {
  min-height: 17px;
  margin-bottom: 15px;
}

.product__link {
  width: 65px;
  text-align: center;
  color: #fff;
  line-height: 17px;
  font-size: 13px;
  border-radius: 10px;
  display: block;
  letter-spacing: 2px;
  min-height: 16px;
  margin: auto;
  -webkit-transition: 1s;
  transition: 1s;
}

.product__link.visible {
  background-color: #383739;
}

.product__title {
  margin-bottom: 7px;
}

.product__title .text {
  color: #595959;
  font-size: 18px;
  font-weight: 700;
  line-height: 24px;
}

.product__price {
  text-align: center;
  line-height: 17px;
}

.product__price .old-price,
.product__price .price {
  color: #595959;
  font-weight: 100;
}

.product__price .old-price {
  font-size: 13px;
  text-decoration: line-through;
}

.product__price .price {
  font-size: 16px;
}

.product__frame {
  position: absolute !important;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: transparent;
  z-index: 10 !important;
  margin: -10px;
  -webkit-transition: 0.5s;
  transition: 0.5s;
  border: 3px solid transparent;
}

.product__frame.active {
  background-color: #e1bc62;
  border-color: #000;
}
<div class="container">

  <ul class="products products_mod products_padding85">
    <li class="title-link products__title">
      <div class="title-link__titles">
        <a class="title-link__title active" href="">
                  FEATURED
                  <span class="arrow"></span>
               </a>

        <a class="title-link__title title-link__title_second" href="">
                  ARRIVALS
                  <span class="arrow"></span>
               </a>
      </div>
      <p class="title-link__advantages">“Whoever said money can’t buy happiness simply didn’t know WHER</p>
    </li>

    <li class="product products__item">
      <a class="product__images" href="#">

        <div class="product__image">
          <img src="http://lorempixel.com/285/300/sports/1" alt="">
        </div>

      </a>
      <div class="product__link-wrap">
        <a class="product__link " href="">

        </a>
      </div>
      <div class="product__title">
        <span class="text">slim pants</span>
      </div>

      <div class="product__price">

        <span class="old-price">$329,00</span>
        <span class="price">$279,00</span>
      </div>
      <div class="product__cart">
        <h3 class="text">ADD TO CART</h3>
      </div>
      <div class="product__wishlist">
        <span class="icon"></span>
        <span class="text"></span>
      </div>
      <div class="product__frame"></div>
    </li>
    <li class="product products__item">
      <a class="product__images" href="#">

        <div class="product__image">
          <img src="http://lorempixel.com/285/300/sports/1" alt="">
        </div>

      </a>
      <div class="product__link-wrap">
        <a class="product__link " href="">

        </a>
      </div>
      <div class="product__title">
        <span class="text">slim pants</span>
      </div>

      <div class="product__price">

        <span class="old-price">$329,00</span>
        <span class="price">$279,00</span>
      </div>
      <div class="product__cart">
        <h3 class="text">ADD TO CART</h3>
      </div>
      <div class="product__wishlist">
        <span class="icon"></span>
        <span class="text"></span>
      </div>
      <div class="product__frame"></div>
    </li>
    <li class="product products__item">
      <a class="product__images" href="#">

        <div class="product__image">
          <img src="http://lorempixel.com/285/300/sports/1" alt="">
        </div>

      </a>
      <div class="product__link-wrap">
        <a class="product__link " href="">

        </a>
      </div>
      <div class="product__title">
        <span class="text">slim pants</span>
      </div>

      <div class="product__price">

        <span class="old-price">$329,00</span>
        <span class="price">$279,00</span>
      </div>
      <div class="product__cart">
        <h3 class="text">ADD TO CART</h3>
      </div>
      <div class="product__wishlist">
        <span class="icon"></span>
        <span class="text"></span>
      </div>
      <div class="product__frame"></div>
    </li>
    <li class="product products__item">
      <a class="product__images" href="#">

        <div class="product__image">
          <img src="http://lorempixel.com/285/300/sports/1" alt="">
        </div>

      </a>
      <div class="product__link-wrap">
        <a class="product__link " href="">

        </a>
      </div>
      <div class="product__title">
        <span class="text">slim pants</span>
      </div>

      <div class="product__price">

        <span class="old-price">$329,00</span>
        <span class="price">$279,00</span>
      </div>
      <div class="product__cart">
        <h3 class="text">ADD TO CART</h3>
      </div>
      <div class="product__wishlist">
        <span class="icon"></span>
        <span class="text"></span>
      </div>
      <div class="product__frame"></div>
    </li>

  </ul>
</div>

Если вам не принципиально, чтобы работало на JQuery, то вот.

2) Можно обойтись без скриптов:

li:hover .product__frame {
   background-color: #e1bc62;
   border-color: #000;
}

li:hover .product__link {
   background-color: #383739;
}
3
  • Благодарю, а вот как сделать с помощью делегирование в JQ!
    – John
    29 июн 2019 в 7:21
  • К сожалению, я не знаю JQ :) 29 июн 2019 в 7:24
  • @John это же на css делается 29 июн 2019 в 7:24

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.