【问题标题】:retina.js v2.0 not working for imagesRetina.js v2.0 不适用于图像
【发布时间】:2017-03-20 20:36:16
【问题描述】:

我尝试使用retina.js v2.0 来交换图像,但它不起作用,我不知道为什么。我也在开发人员工具中检查过,但没有任何错误。你能帮我吗,可能是什么问题?

HTML:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Test</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="robots" content="noindex, nofollow" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>    
</head>
<body>
    <img src="images/logo.png" data-rjs="2" alt="Logo">
    <script type="text/javascript" src="retina.min.js"></script>
</body>
</html>

【问题讨论】:

    标签: retina.js


    【解决方案1】:

    你明白了吗?我有同样的问题。我通过在脚本加载后直接调用retinajs() 找到了一个解决方案。但是,阅读How It Works 文档并不表示您需要这样做。

    这是我所做的:

    <html lang="en">
    <head>
    </head>
    
    <body>
        <img src="/images/nav_logo.png" data-rjs="2">
        <script type="text/javascript" src="/lib/retina/retina.min.js"></script>
        <script>
            retinajs();
        </script>
    </body>
    

    是的,这可行,但我的问题是它是否“正确”?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-20
      • 1970-01-01
      • 1970-01-01
      • 2012-10-15
      • 1970-01-01
      • 2012-07-28
      • 2021-06-18
      • 1970-01-01
      相关资源
      最近更新 更多