-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关于图片加载相关问题 #2
Comments
在此展示部分代码,其中只需使 <div class="bangumi-picture">
<% if(download_image) { %>
<img src="<%= lazyload ? ("/images/loading.gif") : `/images/${item.image}` %>" data-src="<%= `/images/${item.image}` %>" referrerPolicy="no-referrer" width="110" style="width:110px;margin:<%= margin %> auto;" />
<% } else { %>
<img src="<%= lazyload ? ("/images/loading.gif") : `https://lain.bgm.tv/pic/cover/c/${item.image}` %>" data-src="<%= `/images/${item.image}` %>" referrerPolicy="no-referrer" width="110" style="width:110px;margin:<%= margin %> auto;" />
<% } %>
</div> |
其实这个问题是主题对懒加载的不适配,我们可以在这里开启懒加载,但遇到不适配的主题就会出问题。在这里我提供一个主题适配懒加载的方案,只需要先让主题套 let main_js = fs.readFileSync('public/js/main.js');
main_js = main_js.replace(
`$(this).wrap('<a class="gallery-item" href="' + $(this).attr('src') + '"></a>');`,
`$(this).wrap('<a class="gallery-item" href="' + $(this).attr('data-src') || $(this).attr('src') + '"></a>');`,
);
fs.writeFileSync('public/js/main.js', main_js); |
翻页按钮不生效 |
VM6484:6 Uncaught TypeError: Cannot read properties of undefined (reading 'click') |
可否单独开一个issue,介绍一下你使用的主题和番组计划的uid,方便复现场景,或者有没有已经部署可访问的链接 |
收到你的消息回去重新安装插件后,好了。我的链接:https://blhorizon.github.io/bangumis/ |
原Issue:HCLonely/hexo-bilibili-bangumi#134
目前已知插件的懒加载和主题的懒加载存在冲突,如果同时启用就会导致点开一张图片一直转圈圈,就我个人建议的是关闭插件的懒加载,单独使用主题的全局懒加载,以此来给插件提供懒加载。(
data-src
的问题已解决)只需修改
_config.yml
:当然你也可以选择关闭主题的懒加载而单独使用插件的懒加载,但是这样可能并不优雅,尤其是涉及到全局统一性的时候,而且这样会增加不必要的耦合,除非主题没有懒加载功能。
The text was updated successfully, but these errors were encountered: