I will go straight to the example ..
There are several such blocks:
<div class="caption"> <p>тут описание данного блока</p> <a href="#" class="open-dec">Подробнее</a> </div> Clicking on the "Details" link opens the contents of the <P> in the pop-up magnificPopup window - I am writing this jQuery code:
var $link = $(".open-dec"), $self = $link.index(); //здесь по идеи номер элемента, но не знаю как получить var service_api = $('.caption p:eq('+$self+')').text(); $link.magnificPopup({ items: { src: '<div class="white-popup animated zoomInUp">'+service_api+'</div>', type: 'inline' } }); $self variable returns "-1" - according to the idea there is an element number, such as 0, 1, 2, 3, etc.