zoukankan      html  css  js  c++  java
  • holder.js如何使用

    holder.js的使用

    一、总结

    一句话总结:使用:holder.js后面接图片宽高

    <img src="holder.js/300x200" />

    1、holder.js的使用注意事项是什么?

    使用:<img src="holder.js/300x200" />注意事项:300x200里面的符号是x,不是乘法号

    2、holder.js后如何接类似主题这样的参数?

    和url接参数的方式一致,?问号加参数(使用的时候失败了)

    • theme: The theme to use for the placeholder. Example: holder.js/300x200?theme=sky
    • random: Use random theme. Example: holder.js/300x200?random=yes

    二、holder.js的使用

    使用:<img src="holder.js/300x200" />注意事项:300x200里面的符号是x,不是乘法号

    为了避免控制台404错误,您可以使用data-src代替src。<img data-src="holder.js/300x200" />

    Placeholder options are set through URL properties, e.g. holder.js/300x200?x=y&a=b. Multiple options are separated by the & character.

    • theme: The theme to use for the placeholder. Example: holder.js/300x200?theme=sky
    • random: Use random theme. Example: holder.js/300x200?random=yes
    • bg: Background color. Example: holder.js/300x200?bg=2a2025
    • fg: Foreground (text) color. Example: holder.js/300x200?fg=ffffff
    • text: Custom text. Example: holder.js/300x200?text=Hello
    • size: Custom text size. Defaults to pt units. Example: holder.js/300x200?size=50
    • font: Custom text font. Example: holder.js/300x200?font=Helvetica
    • align: Custom text alignment (left, right). Example: holder.js/300x200?align=left
    • outline: Draw outline and diagonals for placeholder. Example: holder.js/300x200?outline=yes
    • lineWrap: Maximum line length to image width ratio. Example: holder.js/300x200?lineWrap=0.5
    测试后的效果
    There are 6 default themes: sky, vine, lava, gray, industrial, and social. Example: holder.js/300x200?theme=social
     
    Themes have 5 properties: fg, bg, size, font and fontweight. The size property specifies the minimum
    font size for the theme. The fontweight default value is bold.
    You can create a sample theme like this:
     
    <script type="text/javascript">
    Holder.addTheme("red", {
    bg: "#F00",
    fg: "#aaa",
    size: 11,
    font: "Monaco",
    fontweight: "normal"
    });
    </script>
    自定义后直接使用:<img src="holder.js/300x200?theme=red" />

    If you have a group of placeholders where you'd like to use particular text, you can do so by adding a text property to the theme:

    Holder.addTheme("thumbnail", { bg: "#fff", text: "Thumbnail" });
    参考:holder.js的使用 - CSDN博客
    https://blog.csdn.net/wang_magento/article/details/78799032
     
     
     
  • 相关阅读:
    C#中sizeof的用法
    C#托管堆对象实例包含什么
    C#引用类型转换的几种方式
    C#中结构(struct)的部分初始化和完全初始化
    C#值类型装箱后能改变其值吗
    C#程序集系列13,如何让CLR选择不同版本的程序集
    C#程序集系列12,C#编译器和CLR如何找寻程序集
    C#程序集系列11,全局程序集缓存
    C#程序集系列10,强名称程序集
    C#程序集系列09,程序集签名
  • 原文地址:https://www.cnblogs.com/Renyi-Fan/p/9505449.html
Copyright © 2011-2022 走看看