carry.js
3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
function carry(obj){
var config = {};
function _init(obj){
config.frameheight =
($(".mylist tr").length-1)*($(".mylist tr").eq(1).height())+145;
config.who = null;
config.which = null;
config.url = null;
config.func = null;
config = $.extend(config,obj);
}
function popup(contents){
Popup.start({
title : contents[0],
content : contents[1],
width : contents[2],
height : contents[3],
hidefooterBar : contents[4],
isrolling : contents[5]
})
}
function _start(n){
switch(n){
case 1:
$("#add-save").live("click",function(){
// contents = ["提示",$('.one-tip').html(),
// 420,200,true,false];
if (config.url){
if (typeof config.func=="function"){
config.func($(this));
}
}
var vals = '<div class="u-olist-box">'+
'<dt><img src="'+ config.which +'" /></dt>'+
'<dd>'+
'<span>'+ config.who.find("span").html() +'</span><br />'+
'<a href="#">查看详情 ></a>'+
'</dd>'+
'<em class="bcol1">已提交</em>'+
'</div>';
$(".be-have").append(vals);
if (config.who.parent().find(".u-no-box").length<=1){
$(".another-service").css("display","none");
};
config.who.remove();
return false;
}).fancybox({
'openEffect' : 'none',
'closeEffect' : 'elastic',
fitToView:false,
padding:6
})
break;
case 2:
$("#add-cancel").live("click",function(){
config.who.find("input").removeAttr("checked");
_close();
return false;
})
break;
default:
$(".u-no-box .link").live("click",function(){
// contents = ["选择需要服务的商品",$('.popup-frame').html(),
// 700,config.frameheight,false,false];
// popup(contents);
config.who = $(this).parent().parent();
config.which = config.who.find(".box-imgs").attr("src");
})
$(".u-no-box .link").fancybox({
'openEffect' : 'none',
'closeEffect' : 'elastic',
fitToView:false,
padding:6
})
break;
};
}
function _close(){
$.fancybox.close();
}
this.run = function(){
_init(obj);
_start();
_start(1);
_start(2);
}
return this;
}
var carry = new carry({url: "http://www.baidu.com",func: function(tag){
}});
carry.run();