基于 backbone的弹窗插件
define(['backbone', 'jquery', 'text!creditCardTpl/page.html'], function (bacobone, jquery, dialog_tpl) {
var dialogView;
dialogView = Backbone.View.extend({
events: {
"touchstart #dialog_ok": "okcallback",
"touchstart #dialog_cancel": "cancelcallback"
},
okcallback: function () {
this.closeDialog()
},
cancelcallback: function () {
this.closeDialog()
},
closeDialog:function(){
if(this.timeCount){
window.clearTimeout(this.timeCount)
}
/* this.$el.css("display","none")*/
this.$el.detach() /*不能用remove,,remove() 不会保留元素的 jQuery 数据。其他的比如绑定的事件、附加的数据等都会被移除*/
},
initialize: function () {
},
ul_tpl:$(dialog_tpl).filter("#dn_ul").html(),
tpl: $(dialog_tpl).filter("#dialog_one").html(),
dialog:function(cssParm){
var Css={contentTpl:this.ul_tpl}
/* var Css={width:"",height:"",left:"",top:"",title:"",contentTpl:"",timeClose:""}*/
_.extend(Css,cssParm)
this.render(Css)
},
render: function (parm) {
this.$el.html(this.tpl)
this.$(".dialog_title").html(parm.title)
this.$(".dialog_content").html(parm.contentTpl)
if (parm.width &&parm.width != "") {
this.$(".dialog_box").css("width", parm.width)
}
if(parm.shadow==false) {
this.$(".dialog_shadow").css("display","none")
}
$("html body").append(this.$el)
if(!parm.left||parm.left==""){
parm.left=( window.screen.width-this.$(".dialog_box ").width())/2
/* this.$(".dialog_box").css("left",left)*/
}
if(!parm.top||parm.top==""){
parm.top=( window.screen.height-this.$(".dialog_box ").height())/2 -200
/* this.$(".dialog_box").css("left",left)*/
}
this.$(".dialog_box").css({"left": parm.left, "top": parm.top})
if(parm.timeClose){
this.timeCount=window.setTimeout(function(){
this.closeDialog()
}.bind(this),parm.timeClose)
}
}
});
return dialogView;
});
基于 backbone的弹窗插件的更多相关文章
- 封装基于jq弹窗插件
相信码友们对于$.fn.extexd();$.extend()以及$.fn.custom和$.custom都有一定的了解:我阐述一下我自己对于$.fn.custom和$.custom的理解.有理解错误 ...
- 原生Js弹窗插件|web弹出层组件|对话框
wcPop.js 是一款基于原生javascript开发的前端 web版 弹窗组件,遵循原生 H5/css3/JS 的书写规范,简单实用.拿来即用(压缩后仅10KB).已经兼容各大主流浏览器.内含多种 ...
- 一款基于react-native的弹窗提示组件
介绍一款基于react-native的弹窗提示插件 react-native-ms , github地址:https://github.com/jiangzhenfei/react-native-ms ...
- ExtJS4.2学习(13)基于表格的扩展插件---rowEditing
鸣谢:http://www.shuyangyang.com.cn/jishuliangongfang/qianduanjishu/2013-11-24/182.html --------------- ...
- Web APP & 弹窗插件
Web APP & 弹窗插件 移动端弹窗插件 alert.confirm.toast.notice 四种类型弹窗 jQuery & Zepto https://github.com/s ...
- jquery弹窗插件layer:layer.layui.com
这两天在做抽奖转盘功能,浏览器自带的alert弹出框太low,本人又基本不会前端, 于是借鉴前人用fancybox插件做的效果 结果没看懂其写法(http://www.0101shop.com/goo ...
- thinkphp 点击某个class提交post值,返回回来用一个弹窗插件,提示返回来要说的话
下一篇文章有讲到弹窗插件的怎么使用,自写教程 如果能帮到你,给点个赞鼓励一下 <============= 控制器 =================> public function ...
- JS编写简单的弹窗插件(含有demo和源码)
最近项目做完了 事情不是很多,今天正好也在调休,所以趁着这个时间研究了一下简易的JS弹窗功能,当然网上这块插件非常多,本人也没有仔细看网上的插件源码 只是凭着日常使用过的弹窗插件有这么多功能 来实现自 ...
- 基于jquery下拉列表树插件代码
分享一款基于jquery下拉列表树插件代码.这是一款实用的jquery 树形下拉框 下拉树代码下载.效果图如下: 在线预览 源码下载 实现的代码. html代码: <table width= ...
随机推荐
- ZOJ 3910 Market ZOJ Monthly, October 2015 - H
Market Time Limit: 2 Seconds Memory Limit: 65536 KB There's a fruit market in Byteland. The sal ...
- BZOJ3165 : [Heoi2013]Segment
建立线段树,每个节点维护该区间内的最优线段. 插入线段时,在线段树上分裂成$O(\log n)$棵子树,若与当前点的最优线段不相交,那么取较优的,否则暴力递归子树. 查询时在叶子到根路径上所有点的最优 ...
- SecureCrt脚本(三)二级对象之Screen详解
Crt自动化 测试 SecureCrt脚本 JS脚本 1.引言 2.Screen属性和方法 2.1.属性 2.1.1.CurrentColumn 2.1.2.CurrentRow 2.1.3.Co ...
- MyBatis insert返回主键(sqlserver2008)
mybatis insert返回主键(sqlserver2008) MyBatisXML配置,下面两种方式都行 方式1: <insert id="insert" para ...
- SparkContext.setCheckpointDir()
class SparkContext extends Logging with ExecutorAllocationClient Main entry point for Spark function ...
- Html - 返回Top
制作浮动top $(window).scroll( function() { var scrollValue=$(window).scrollTop(); scrollValue > 600 ? ...
- 开发基础框架:mybatis-3.2.8 +hibernate4.0+spring3.0+struts2.3
一:项目下载地址(点击 Source code(zip)) https://github.com/fzxblgong/frame_2014-12-15/releases 版本:v1.2大小:20M 二 ...
- [ZZ] GTX760首测
再一次让AMD难做!NVIDIA新主力GTX760首测 1又见短板高端显卡,GTX760外观对比回顶部 [PConline评测]NVIDIA迅速的步伐真让人吃惊,短时间内拿出GTX780.GTX770 ...
- UITableview cell 的多选
利用NSMutableDictionary key值 来改变cell的状态 -(void)createUI{ table = [[UITableView alloc]initWithFrame:CG ...
- mysql查询所有字段(*),并且联表时需要特别注意的地方
如果不标明*是读取哪个表,确实会将所有三个表都读出来.需要小心