Browse Source

img lazyload improve

master
filesite 7 months ago
parent
commit
67adb36129
  1. 7
      themes/tajian/views/site/index.php
  2. 6
      themes/tajian/views/site/myindex.php

7
themes/tajian/views/site/index.php

@ -63,14 +63,15 @@ eof;
$pubDate = date('m/d', $file['fstat']['ctime']); $pubDate = date('m/d', $file['fstat']['ctime']);
$imgSrc = $index < 8 ? " src=\"{$snapshot}\"" : ''; $imgSrc = $index < 4 ? " src=\"{$snapshot}\"" : '';
$imgAlt = $index < 8 ? " alt=\"{$title}\"" : ''; $imgAlt = $index < 4 ? " alt=\"{$title}\"" : '';
$imgCls = $index < 4 ? '' : 'lazy';
echo <<<eof echo <<<eof
<div class="vl_list_main advideo-item"> <div class="vl_list_main advideo-item">
<div class="video_img_vl"> <div class="video_img_vl">
<a href="{$file['shortcut']['url']}" target="_blank"> <a href="{$file['shortcut']['url']}" target="_blank">
<img data-original="{$snapshot}" class="lazy"{$imgSrc}{$imgAlt}> <img data-original="{$snapshot}" class="{$imgCls}"{$imgSrc}{$imgAlt}>
</a> </a>
</div> </div>
<div class="video_title_vl"> <div class="video_title_vl">

6
themes/tajian/views/site/myindex.php

@ -69,9 +69,9 @@ eof;
$pubDate = date('m/d', $file['fstat']['ctime']); $pubDate = date('m/d', $file['fstat']['ctime']);
$imgSrc = $tagIndex == 0 && $index < 8 ? " src=\"{$snapshot}\"" : ''; $imgSrc = $tagIndex == 0 && $index < 4 ? " src=\"{$snapshot}\"" : '';
$imgAlt = $tagIndex == 0 && $index < 8 ? " alt=\"{$title}\"" : ''; $imgAlt = $tagIndex == 0 && $index < 4 ? " alt=\"{$title}\"" : '';
$imgCls = $tagIndex == 0 && $index < 8 ? '' : 'lazy'; $imgCls = $tagIndex == 0 && $index < 4 ? '' : 'lazy';
$itemCls = $index < 4 ? '' : 'hidden-xs'; $itemCls = $index < 4 ? '' : 'hidden-xs';
echo <<<eof echo <<<eof

Loading…
Cancel
Save