@Soon346

Почему не срабатывает код js?

Имею html кнопки такого вида

<div class="story__share" title="Поделиться"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon--story__share"><use xlink:href="#icon--story__share"></use></svg></div>

<div class="social" style="display: none" data-url="" data-title="" data-image="" data-description="" data-time="">
				<a href="" target="_blank" rel="nofollow noopener" class="social__button" data-type="vk"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon--social__vk"><use xlink:href="#icon--social__vk"></use></svg></a>
				<a href="" target="_blank" rel="nofollow noopener" class="social__button" data-type="facebook"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon--social__facebook"><use xlink:href="#icon--social__facebook"></use></svg></a>
				<a href="" target="_blank" rel="nofollow noopener" class="social__button" data-type="twitter"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon--social__twitter"><use xlink:href="#icon--social__twitter"></use></svg></a>
			</div>


По нажатию на

<div class="story__share" title="Поделиться"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon--story__share"><use xlink:href="#icon--story__share"></use></svg></div>


она принимает style="display:none; и скрывается, за место этой кнопки появляются

<div class="social" style="" data-url="" data-title="" data-image="" data-description="" data-time="">
				<a href="" target="_blank" rel="nofollow noopener" class="social__button" data-type="vk"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon--social__vk"><use xlink:href="#icon--social__vk"></use></svg></a>
				<a href="" target="_blank" rel="nofollow noopener" class="social__button" data-type="facebook"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon--social__facebook"><use xlink:href="#icon--social__facebook"></use></svg></a>
				<a href="" target="_blank" rel="nofollow noopener" class="social__button" data-type="twitter"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon--social__twitter"><use xlink:href="#icon--social__twitter"></use></svg></a>
			</div>


А вот сам js который должен обрабатывать все это дело

_attachSocialButton() {
                    return !!this.$(".social").length && (["story"].includes(this.feedName) && new N(this.$(".social")), this.$el.on("click", ".story__share", t => V(t.currentTarget).hide().next().fadeIn(300)), this)
                }


но почему-то он не срабатывает... подскажите пожалуйста как его запустить
  • Вопрос задан
  • 113 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы