alloy-ui 2.0.0 图片轮播
来源:互联网 发布:windows清理助手在哪儿 编辑:程序博客网 时间:2024/06/07 23:42
解压alloy-2.0.0文件之后,demos文件夹下有很多事例,build文件夹中为编译后的事例
本案例以图片轮播为案例:
alloy-2.0.0\demos\carousel 文件夹下的index.html为显示页面,查看源码可以找到需要引用的代码,下面为Portlet如何引用
=================================================================
创建一个Portlet,在JSP文件中引入代码:
JSP
<%@ page contentType="text/html; charset=UTF-8" %><%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %><portlet:defineObjects /><%String basePath = renderRequest.getContextPath();%><script type="text/javascript">//加载AUIAUI().use('node', 'module2', 'module3',function (A) { //将节点内容打印到控制台 console.log(A.one("#example").html());});</script><html> <h1>AlloyUI - Carousel图片轮播</h1> <div id="demo"> <div style="background: url(<%=basePath%>/assets/article0.png); width: 940px; height: 253px;" class="carousel-item carousel-item-active"></div> <div style="background: url(<%=basePath%>/assets/article1.png); width: 940px; height: 253px;" class="carousel-item"></div> <div style="background: url(<%=basePath%>/assets/article2.png); width: 940px; height: 253px;" class="carousel-item"></div> <div style="background: url(<%=basePath%>/assets/article3.png); width: 940px; height: 253px;" class="carousel-item"></div> <div style="background: url(<%=basePath%>/assets/article0.png); width: 940px; height: 253px;" class="carousel-item"></div> <div style="background: url(<%=basePath%>/assets/article1.png); width: 940px; height: 253px;" class="carousel-item"></div> <div style="background: url(<%=basePath%>/assets/article2.png); width: 940px; height: 253px;" class="carousel-item"></div> <div style="background: url(<%=basePath%>/assets/article3.png); width: 940px; height: 253px;" class="carousel-item"></div> </div> <script> AUI().use('aui-carousel', function(A) { new A.Carousel({ intervalTime: 1,//播放频率,越小越快 contentBox: '#demo', activeIndex: 0, height: 254, width: 940 }).render(); }); </script></html>
只需要修改路径(通过getContentPath方法获取),不需要源码中的以下引入,因为Liferay中内部已经引入过了
<link rel="stylesheet" href="../../build/aui-css/css/bootstrap.css"><script src="../../build/aui/aui.js"></script>
----------------------------------------------------------------
Portlet中显示如下:
阅读全文
0 0
- alloy-ui 2.0.0 图片轮播
- Alloy UI taglibs
- Liferay Alloy UI
- AngularJS+ui.bootstrap实现图片轮播
- UI基础第十三弹: UIScrollView控件实现图片轮播
- UI基础 简单图片轮播器用到的知识
- 图片轮播
- 腾讯图片轮播
- js图片轮播
- js图片轮播
- JavaScript 图片轮播
- js图片轮播
- jquery 图片轮播
- jquery图片轮播
- 图片轮播
- 图片轮播
- 图片轮播插件
- JS 图片轮播
- C++学习之对string流的初步认识
- 基于akka与scala实现一个简单rpc框架
- HTML5
- Linux学习之用户,组的基本操作
- Leetcode-Set Matrix Zeroes
- alloy-ui 2.0.0 图片轮播
- angularjs的二种数据绑定
- 使用URL Rewrite 实现网站伪静态
- 模仿QQ左划显示置顶, 标记, 删除
- HTML CSS总结
- servlet程序HTTP Status 500
- 【java基础】怎样结束控制台输入
- java夯实基础-输入输出流
- 第二篇 基本元器件认识---电容