From 67adb3612928b32a853d042c276aec04d1a447c8 Mon Sep 17 00:00:00 2001 From: filesite Date: Tue, 7 May 2024 13:05:35 +0000 Subject: [PATCH] img lazyload improve --- themes/tajian/views/site/index.php | 7 ++++--- themes/tajian/views/site/myindex.php | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/themes/tajian/views/site/index.php b/themes/tajian/views/site/index.php index ea8e077..d631290 100644 --- a/themes/tajian/views/site/index.php +++ b/themes/tajian/views/site/index.php @@ -63,14 +63,15 @@ eof; $pubDate = date('m/d', $file['fstat']['ctime']); - $imgSrc = $index < 8 ? " src=\"{$snapshot}\"" : ''; - $imgAlt = $index < 8 ? " alt=\"{$title}\"" : ''; + $imgSrc = $index < 4 ? " src=\"{$snapshot}\"" : ''; + $imgAlt = $index < 4 ? " alt=\"{$title}\"" : ''; + $imgCls = $index < 4 ? '' : 'lazy'; echo <<
diff --git a/themes/tajian/views/site/myindex.php b/themes/tajian/views/site/myindex.php index 7dc69fe..a811d84 100644 --- a/themes/tajian/views/site/myindex.php +++ b/themes/tajian/views/site/myindex.php @@ -69,9 +69,9 @@ eof; $pubDate = date('m/d', $file['fstat']['ctime']); - $imgSrc = $tagIndex == 0 && $index < 8 ? " src=\"{$snapshot}\"" : ''; - $imgAlt = $tagIndex == 0 && $index < 8 ? " alt=\"{$title}\"" : ''; - $imgCls = $tagIndex == 0 && $index < 8 ? '' : 'lazy'; + $imgSrc = $tagIndex == 0 && $index < 4 ? " src=\"{$snapshot}\"" : ''; + $imgAlt = $tagIndex == 0 && $index < 4 ? " alt=\"{$title}\"" : ''; + $imgCls = $tagIndex == 0 && $index < 4 ? '' : 'lazy'; $itemCls = $index < 4 ? '' : 'hidden-xs'; echo <<