MCPcopy Create free account
hub / github.com/codemistic/Web-Development / loadImages

Function loadImages

apymonkey/public/slick/slick.js:1520–1572  ·  view source on GitHub ↗
(imagesScope)

Source from the content-addressed store, hash-verified

1518 loadRange, cloneRange, rangeStart, rangeEnd;
1519
1520 function loadImages(imagesScope) {
1521
1522 $('img[data-lazy]', imagesScope).each(function() {
1523
1524 var image = $(this),
1525 imageSource = $(this).attr('data-lazy'),
1526 imageSrcSet = $(this).attr('data-srcset'),
1527 imageSizes = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'),
1528 imageToLoad = document.createElement('img');
1529
1530 imageToLoad.onload = function() {
1531
1532 image
1533 .animate({ opacity: 0 }, 100, function() {
1534
1535 if (imageSrcSet) {
1536 image
1537 .attr('srcset', imageSrcSet );
1538
1539 if (imageSizes) {
1540 image
1541 .attr('sizes', imageSizes );
1542 }
1543 }
1544
1545 image
1546 .attr('src', imageSource)
1547 .animate({ opacity: 1 }, 200, function() {
1548 image
1549 .removeAttr('data-lazy data-srcset data-sizes')
1550 .removeClass('slick-loading');
1551 });
1552 _.$slider.trigger('lazyLoaded', [_, image, imageSource]);
1553 });
1554
1555 };
1556
1557 imageToLoad.onerror = function() {
1558
1559 image
1560 .removeAttr( 'data-lazy' )
1561 .removeClass( 'slick-loading' )
1562 .addClass( 'slick-lazyload-error' );
1563
1564 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]);
1565
1566 };
1567
1568 imageToLoad.src = imageSource;
1569
1570 });
1571
1572 }
1573
1574 if (_.options.centerMode === true) {
1575 if (_.options.infinite === true) {

Callers 1

slick.jsFile · 0.85

Calls 1

$Function · 0.50

Tested by

no test coverage detected