• 技术文章 >web前端 >H5教程

    基于HTML5 SVG可互动的3D标签云jQuery插件

    PHP中文网PHP中文网2017-03-30 17:47:40原创1569
    简要教程

    svg3dtagcloud.js是一款基于HTML5 SVG的3D标签云jQuery插件。该3D标签云插件不需要额外的CSS样式,可使用鼠标与标签进行互动,并提供很多参数来控制标签云的外观。

    使用方法

    使用该3D标签云插件需要引入jQuery和jquery.svg3dtagcloud.min.js文件。

    <script src="js/jquery.min.js"></script>
    <script src="js/jquery.svg3dtagcloud.min.js"></script>

    HTML结构

    可以使用一个<p>容器来作为该3D标签云的包裹容器

    <p id="tag-cloud"></p>

    初始化插件

    首先你需要设置一个对象数组遍历,数组中包含你需要制作的标签和它们对应的链接地址。

    var entries = [ 
                    { label: 'CodePen', url: 'http://codepen.io/', target: '_top' },
                    { label: 'three.js', url: 'http://threejs.org/', target: '_top' },
                    { label: 'JS Compress', url: 'http://jscompress.com/', target: '_top' },
                    { label: 'TinyPNG', url: 'https://tinypng.com/', target: '_top' },
                    { label: 'Can I Use', url: 'http://caniuse.com/', target: '_top' },
                    { label: 'URL shortener', url: 'https://goo.gl/', target: '_top' },
                    { label: 'Twitter', url: 'https://twitter.com/', target: '_top' },
                    { label: 'Gulp', url: 'http://gulpjs.com/', target: '_top' },
                    { label: 'Browsersync', url: 'https://www.browsersync.io/', target: '_top' },
                    { label: 'GitHub', url: 'https://github.com/', target: '_top' },
                    { label: 'Shadertoy', url: 'https://www.shadertoy.com/', target: '_top' },
                    { label: 'jsPerf', url: 'http://jsperf.com/', target: '_top' },
                    { label: 'Foundation', url: 'http://foundation.zurb.com/', target: '_top' },
                    { label: 'CreateJS', url: 'http://createjs.com/', target: '_top' },
                    { label: 'Velocity.js', url: 'http://julian.com/research/velocity/', target: '_top' },
                    { label: 'jQuery', url: 'https://jquery.com/', target: '_top' },
                ];

    然后可以通过下面的方法来初始化该3D标签云插件。

    $( '#tag-cloud' ).svg3DTagCloud( {entries: entries} );

    配置参数

    svg3dtagcloud.js插件的可用配置参数有:

    entries:一个对象数组,用于初始化标签。

    width:标签云的宽度。

    height:标签云的高度。

    radius:标签云的半径。

    radiusMin:标签云的最小半径。

    bgDraw:是否使用背景色。

    bgColor:背景颜色。

    opacityOver:鼠标滑过标签时的标签透明度。

    opacityOut:鼠标离开标签时的标签透明度。

    opacitySpeed:标签透明度过渡速度。

    fov:how the content is presented。

    speed:标签云动画的速度。

    fontFamily:标签云的字体。

    fontSize:标签云的字体大小。

    fontColor:标签云的字体颜色。

    fontWeight:标签云的字体的fontWeight。

    fontStyle:标签云的字体样式。

    fontStretch:标签云的字体的fontStretch。

    fontToUpperCase:是否转换为大写字体。

    以上就是基于HTML5 SVG可互动的3D标签云jQuery插件的内容,更多相关内容请关注PHP中文网(m.sbmmt.com)!

    声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
    上一篇:基于HTML5 Canvas实现视频破碎重组特效 下一篇:AngularJS中使用HTML5摄像头拍照

    相关文章推荐

    • html5离线存储有哪些• h5新增标签audio与video的使用• 深入解析asp.net中mvc4自定义404页面(分享)• 你值得了解的HTTP缓存机制(代码详解)• html5新增了什么

    全部评论我要评论

  • 取消发布评论发送
  • 1/1

    PHP中文网