There is a gallery that dynamically changes 8 images on the main page. There is a task to wrap each image in a block with text that will be displayed on top of the image. I can’t catch img. Here is some sample html code:
<ul id="vd"> <li><img src="gallery/main_gallery/1.svg"/></li> <li><img src="gallery/main_gallery/2.jpg"/></li> <li><img src="gallery/main_gallery/3.jpg"/></li> <li><img src="gallery/main_gallery/5.jpg"/></li> <li><img src="gallery/main_gallery/6.jpg"/></li> <li><img src="gallery/main_gallery/7.jpg"/></li> <li><img src="gallery/main_gallery/8.jpg"/></li> </ul> <div id="p12"> </div> From the block with id = vd, the script takes images for the gallery and displays them in the block with id = p12. So you can not pull them out of id = p12. Here is the code that forms the gallery script in the id = p12 block:
<div id="slideshowify-1480244926249" style="position: absolute; overflow: hidden; z-index: -2; left: 0px; top: 0px; width: 100%; height: 100%;"> <img src="gallery/main_gallery/1.svg" style="position: absolute; z-index: -1; width: 1020px; height: 574.052px; top: 0px; transform: scale(1, 1); transition: transform 9000ms ease-in-out;"> </div> Here is the script itself:
(function($){ $.fn.slideshowify = function(/* config */){ var _self = this, _imgs = [], _imgIndex = -1, _imgIndexNext = 0, // for preloading next _transition = true, // use CSS3 transitions (default might be changed during init) _easing = 'in-out', _viewEl = document, // filled by slideshow (used for determining dimensions) _containerId = "slideshowify-" + new Date().getTime(), _containerCSS = { "position" : "absolute", "overflow" : "hidden", "z-index" : "-2", "left" : "0", "top" : "0", "width" : "100%", "height" : "100%" }, _cfg = { parentEl : "body", // slideshow-container is injected into this blend : "into", // "into" || "toBg" randomize : false, fadeInSpeed : 1500, fadeOutSpeed : 1500, aniSpeedMin : 9000, aniSpeedMax : 15000 }, _$viewEl, _$parentEl; if (arguments[0]){ $.extend(_cfg, arguments[0]); // reconfigure if (_cfg.parentEl != "body") { _viewEl = _cfg.parentEl; } } // local refs _$viewEl = $(_viewEl); _$parentEl = $(_cfg.parentEl); /** * Fill viewEl with image (most likely cropped based on its dimensions and view size). * @TODO Add support for target divs whose dimensions were set with %s (get px value from parents). * @TODO Add a window resize handler (adjust photo dims/margins). */ function _revealImg(curImg){ var $img = $(this), viewW = _$viewEl.width(), viewH = _$viewEl.height(), viewRatio = viewW/viewH, imgRatio = $img.width()/$img.height(), marginThreshold = Math.floor(Math.max(viewW, viewH)/10), // for zoom transitions direction = Math.round(Math.random()), transAttr = {}, transProps, marginPixels, modDims; // will hold values to set and animate if (imgRatio > viewRatio){ modDims = _transition ? direction ? {dim:'left', attr:'x', sign:'-'} : {dim:'right', attr:'x', sign:''} : direction ? {dim:'left', attr:'left', sign:'-'} : {dim:'right', attr:'right', sign:'-'}; $img.height(viewH + 'px').width(curImg.w * (viewH/curImg.h) + 'px'); marginPixels = $img.width() - viewW; } else { modDims = _transition ? direction ? {dim:'top', attr:'y', sign:'-'} : {dim:'bottom', attr:'y', sign:''} : direction ? {dim:'top', attr:'top', sign:'-'} : {dim:'bottom', attr:'bottom', sign:'-'}; $img.width(viewW+'px').height(curImg.h * (viewW/curImg.w) + 'px'); marginPixels = $img.height() - viewH; } $img.css(modDims.dim, '0'); transAttr[modDims.attr] = modDims.sign + marginPixels + 'px'; // if marginThreshold is small, zoom a little instead of panning if (_transition && marginPixels < marginThreshold){ if (direction){ // zoom out $img.css('scale','1.2'); transAttr = {'scale':'1'}; } else { // zoom in transAttr = {'scale':'1.2'}; } } transProps = { duration : Math.min(Math.max(marginPixels * 10, _cfg.aniSpeedMin), _cfg.aniSpeedMax), easing : _easing, queue : false, complete : function(){ _$parentEl.trigger('beforeFadeOut', _imgs[_imgIndex]) $img.fadeOut(_cfg.fadeOutSpeed, function(){ _$parentEl.trigger('afterFadeOut', _imgs[_imgIndex]); $img.remove(); }); _loadImg(); } }; _$parentEl.trigger('beforeFadeIn', _imgs[_imgIndex]); $img.fadeIn(_cfg.fadeInSpeed, function(){ $img.css('z-index', -1); _$parentEl.trigger('afterFadeIn', _imgs[_imgIndex]) }); // use animate if css3 transitions aren't supported _transition ? $img.transition($.extend(transAttr, transProps)) : $img.animate(transAttr, transProps); } // end of _revealImg() /** * Loads image and starts display flow */ function _loadImg(){ var img = new Image(), nextImg = new Image(), // for preloading len = _imgs.length; _imgIndex = (_imgIndex < len-1) ? _imgIndex+1 : 0; $(img) // assign handlers .load(function(){ if (_cfg.blend==='into'){ $(this).css({'position':'absolute', 'z-index':'-2'}); $('#'+_containerId).append(this); } else { // @TODO verify that this works $('#'+_containerId).empty().append(this); } _revealImg.call(this, _imgs[_imgIndex]); }) .error(function(){ throw new Error("Ой не могу загрузить изображение."); }) .hide() .attr("src", _imgs[_imgIndex].src); // load if (_imgIndexNext == len) return; // nothing left to preload // preload next image _imgIndexNext = _imgIndex + 1; if (_imgIndexNext < len-1){ nextImg.src = _imgs[_imgIndexNext].src; } } // end of _loadImg() // INITIALIZE if (!$.support.transition) { _transition = false; _easing = 'swing'; } if (!_cfg.imgs){ // images were passed as selector // load images into private array $(this).each(function(i, img){ $(img).hide(); _imgs.push({ src : $(img).attr('src'), w : $(img).width(), h : $(img).height() }); }); } else { _imgs = _cfg.imgs; } if (_cfg.randomize){ _imgs.sort(function(){ return 0.5 - Math.random(); }); } // create container div $("<div id='"+_containerId+"'></div>") .css(_containerCSS) .appendTo(_cfg.parentEl); // start _loadImg(); return this; }; /** * Expose slideshowify() to jQuery for use without DOM selector. */ $.slideshowify = function(cfg){ var _self = this, _cfg = { dataUrl : "", dataType : "json", async : true, filterFn : function(data){ return data; } // default filter. does nothing }; $.extend(_cfg, cfg); $.ajax({ url : _cfg.dataUrl, dataType : _cfg.dataType, async : _cfg.async, success : function(imgs){ _cfg.imgs = _cfg.filterFn(imgs); $({}).slideshowify(_cfg); } }); }; }(jQuery));