underscore template的应用
来源:互联网 发布:泛洪算法 编辑:程序博客网 时间:2024/06/03 17:32
下面是underscore的template的一个例子,可以直接粘去用
<!DOCTYPE html><html><head> <meta charset="utf-8" /> <title>Underscore</title> <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="format-detection" content="telephone=no"/> <link href="index.css" rel="stylesheet" type="text/css" /> <script src="jquery.js"></script> <script src="underscore.js"></script></head><body></body></html><!--ace-template demo--> <script id="t2" type="text/template"> <%_.each(datas, function(item) {%> <div class="outer"> <div class="title"> <span ><%=item.film%></span> </div> <ul class="ul"> <%_.each(datas, function(item) {%> <li> <a href="<%=item.url%>">【<%=item.title%>】</a> </li> <%});%> </ul> </div> <%});%> </script><!--数据 --> <script> var datas = [ { title: "一九四二", url: "http://www.baidu.com", film:"电影1" }, { title: "少年派的漂流", url: "http://www.baidu.com", film:"电影2" }, { title: "教父", url: "http://www.baidu.com", film:"电影3" }, { title: "肖申克的救赎", url: "http://www.baidu.com", film:"电影4" }, { title: "3d2012", url: "http://www.baidu.com", film:"电影5" } ]; $("body").html( _.template($("#t2").html(), datas)); </script><!--点击下拉事件--> <script type="text/javascript"> $('.ul').hide(); $('.ul>li:last-child').addClass('last-li'); $('body>div:first-child>ul').show(); $('.title').click(function(){ $(this).siblings().toggle(); $(this).parent().siblings().children('.bbs-nav-ul').hide(); }) $('.title').hover(function(){ $(this).toggleClass('hover'); }) $('.ul>li').hover(function(){ $(this).toggleClass('hover'); }) </script
0 0
- underscore template的应用
- underscore 的template 的魔板引擎
- Underscore.js-template模板
- underscore.js中template
- underscore _.template()
- template模版引擎的使用(underscore.js)
- Underscore模版引擎的使用-template方法
- template的应用
- (二)underscore.js框架Utility类API学习以及模型template的详细介绍
- Underscore.js template()函数全解析
- underscore.js 剩余属性1-- template
- 关于 underscore 中模板引擎的应用示例
- 优雅的underscore
- underscore 常用的方法
- underscore.js的用法
- underscore库的使用
- Underscore
- Underscore
- 19.2 Partitioning Types--range 分区
- Tog Cat 打印日志过滤
- codeforce 332C Students' Revenge
- 认识 Android 中的 Activity 组件 总结
- dexindexoverflowException 65536 的问题
- underscore template的应用
- OC学习笔记之单例模式
- Ubuntu14.04引导界面美化(burg)
- HTML学习笔记(2)——其他标签
- android学习笔记(3)Button控件的学习
- Word Maze(单词迷宫)
- 打造一个全命令行的Android构建系统
- apache .htaccess文件详解和配置技巧总结
- C++实现的Vector类