Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
张桐
/
h5Officialwebsite
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
张桐
8 years ago
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1497f12f875e1efe5f5a237c5b501fba17e2b0a7
1497f12f
1 parent
7264d87b
master
修改申请试用页面--申请按钮
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
236 行增加
和
0 行删除
css/trials.css
js/index.js
js/jquery.js
js/jquery.poshytip.min.js
js/validate.js
productTrials.html
css/trials.css
查看文件 @
1497f12
...
...
@@ -75,3 +75,64 @@ html,body{
.submit_trail
:hover
{
background
:
#00b960
;
}
.tip-yellowsimple
{
z-index
:
1000
;
text-align
:
left
;
border
:
1px
solid
#c7bf93
;
border-radius
:
4px
;
-moz-border-radius
:
4px
;
-webkit-border-radius
:
4px
;
padding
:
6px
8px
;
min-width
:
50px
;
max-width
:
300px
;
color
:
#000
;
background-color
:
#fff9c9
;
/**
* - If you set a background-image, border/padding/background-color will be ingnored.
* You can set any padding to .tip-inner instead if you need.
* - If you want a tiled background-image and border/padding for the tip,
* set the background-image to .tip-inner instead.
*/
}
.tip-yellowsimple
.tip-inner
{
font
:
12px
/
16px
arial
,
helvetica
,
sans-serif
;
}
/* Configure an arrow image - the script will automatically position it on the correct side of the tip */
.tip-yellowsimple
.tip-arrow-top
{
margin-top
:
-6px
;
margin-left
:
-5px
;
/* approx. half the width to center it */
top
:
0
;
left
:
50%
;
width
:
9px
;
height
:
6px
;
}
.tip-yellowsimple
.tip-arrow-right
{
margin-top
:
-4px
;
/* approx. half the height to center it */
margin-left
:
0
;
top
:
50%
;
left
:
100%
;
width
:
6px
;
height
:
9px
;
}
.tip-yellowsimple
.tip-arrow-bottom
{
margin-top
:
0
;
margin-left
:
-5px
;
/* approx. half the width to center it */
top
:
100%
;
left
:
50%
;
width
:
9px
;
height
:
6px
;
}
.tip-yellowsimple
.tip-arrow-left
{
margin-top
:
-4px
;
/* approx. half the height to center it */
margin-left
:
-6px
;
top
:
50%
;
left
:
0
;
width
:
6px
;
height
:
9px
;
}
...
...
js/index.js
查看文件 @
1497f12
...
...
@@ -163,4 +163,6 @@
}
}();
...
...
js/jquery.js
0 → 100644
查看文件 @
1497f12
此 diff 太大无法显示。
js/jquery.poshytip.min.js
0 → 100644
查看文件 @
1497f12
/*
* Poshy Tip jQuery plugin v1.2
* http://vadikom.com/tools/poshy-tip-jquery-plugin-for-stylish-tooltips/
* Copyright 2010-2013, Vasil Dinkov, http://vadikom.com/
*/
(
function
(
e
){
var
a
=
[],
d
=
/^url
\([
"'
]?([^
"'
\)]
*
)[
"'
]?\)
;
?
$/i
,
c
=
/
\.
png$/i
,
b
=!!
window
.
createPopup
&&
document
.
documentElement
.
currentStyle
.
minWidth
==
"undefined"
;
function
f
(){
e
.
each
(
a
,
function
(){
this
.
refresh
(
true
)})}
e
(
window
).
resize
(
f
);
e
.
Poshytip
=
function
(
h
,
g
){
this
.
$elm
=
e
(
h
);
this
.
opts
=
e
.
extend
({},
e
.
fn
.
poshytip
.
defaults
,
g
);
this
.
$tip
=
e
([
'<div class="'
,
this
.
opts
.
className
,
'">'
,
'<div class="tip-inner tip-bg-image"></div>'
,
'<div class="tip-arrow tip-arrow-top tip-arrow-right tip-arrow-bottom tip-arrow-left"></div>'
,
"</div>"
].
join
(
""
)).
appendTo
(
document
.
body
);
this
.
$arrow
=
this
.
$tip
.
find
(
"div.tip-arrow"
);
this
.
$inner
=
this
.
$tip
.
find
(
"div.tip-inner"
);
this
.
disabled
=
false
;
this
.
content
=
null
;
this
.
init
()};
e
.
Poshytip
.
prototype
=
{
init
:
function
(){
a
.
push
(
this
);
var
g
=
this
.
$elm
.
attr
(
"title"
);
this
.
$elm
.
data
(
"title.poshytip"
,
g
!==
undefined
?
g
:
null
).
data
(
"poshytip"
,
this
);
if
(
this
.
opts
.
showOn
!=
"none"
){
this
.
$elm
.
bind
({
"mouseenter.poshytip"
:
e
.
proxy
(
this
.
mouseenter
,
this
),
"mouseleave.poshytip"
:
e
.
proxy
(
this
.
mouseleave
,
this
)});
switch
(
this
.
opts
.
showOn
){
case
"hover"
:
if
(
this
.
opts
.
alignTo
==
"cursor"
){
this
.
$elm
.
bind
(
"mousemove.poshytip"
,
e
.
proxy
(
this
.
mousemove
,
this
))}
if
(
this
.
opts
.
allowTipHover
){
this
.
$tip
.
hover
(
e
.
proxy
(
this
.
clearTimeouts
,
this
),
e
.
proxy
(
this
.
mouseleave
,
this
))}
break
;
case
"focus"
:
this
.
$elm
.
bind
({
"focus.poshytip"
:
e
.
proxy
(
this
.
showDelayed
,
this
),
"blur.poshytip"
:
e
.
proxy
(
this
.
hideDelayed
,
this
)});
break
}}},
mouseenter
:
function
(
g
){
if
(
this
.
disabled
){
return
true
}
this
.
$elm
.
attr
(
"title"
,
""
);
if
(
this
.
opts
.
showOn
==
"focus"
){
return
true
}
this
.
showDelayed
()},
mouseleave
:
function
(
g
){
if
(
this
.
disabled
||
this
.
asyncAnimating
&&
(
this
.
$tip
[
0
]
===
g
.
relatedTarget
||
jQuery
.
contains
(
this
.
$tip
[
0
],
g
.
relatedTarget
))){
return
true
}
if
(
!
this
.
$tip
.
data
(
"active"
)){
var
h
=
this
.
$elm
.
data
(
"title.poshytip"
);
if
(
h
!==
null
){
this
.
$elm
.
attr
(
"title"
,
h
)}}
if
(
this
.
opts
.
showOn
==
"focus"
){
return
true
}
this
.
hideDelayed
()},
mousemove
:
function
(
g
){
if
(
this
.
disabled
){
return
true
}
this
.
eventX
=
g
.
pageX
;
this
.
eventY
=
g
.
pageY
;
if
(
this
.
opts
.
followCursor
&&
this
.
$tip
.
data
(
"active"
)){
this
.
calcPos
();
this
.
$tip
.
css
({
left
:
this
.
pos
.
l
,
top
:
this
.
pos
.
t
});
if
(
this
.
pos
.
arrow
){
this
.
$arrow
[
0
].
className
=
"tip-arrow tip-arrow-"
+
this
.
pos
.
arrow
}}},
show
:
function
(){
if
(
this
.
disabled
||
this
.
$tip
.
data
(
"active"
)){
return
}
this
.
reset
();
this
.
update
();
if
(
!
this
.
content
){
return
}
this
.
display
();
if
(
this
.
opts
.
timeOnScreen
){
this
.
hideDelayed
(
this
.
opts
.
timeOnScreen
)}},
showDelayed
:
function
(
g
){
this
.
clearTimeouts
();
this
.
showTimeout
=
setTimeout
(
e
.
proxy
(
this
.
show
,
this
),
typeof
g
==
"number"
?
g
:
this
.
opts
.
showTimeout
)},
hide
:
function
(){
if
(
this
.
disabled
||!
this
.
$tip
.
data
(
"active"
)){
return
}
this
.
display
(
true
)},
hideDelayed
:
function
(
g
){
this
.
clearTimeouts
();
this
.
hideTimeout
=
setTimeout
(
e
.
proxy
(
this
.
hide
,
this
),
typeof
g
==
"number"
?
g
:
this
.
opts
.
hideTimeout
)},
reset
:
function
(){
this
.
$tip
.
queue
([]).
detach
().
css
(
"visibility"
,
"hidden"
).
data
(
"active"
,
false
);
this
.
$inner
.
find
(
"*"
).
poshytip
(
"hide"
);
if
(
this
.
opts
.
fade
){
this
.
$tip
.
css
(
"opacity"
,
this
.
opacity
)}
this
.
$arrow
[
0
].
className
=
"tip-arrow tip-arrow-top tip-arrow-right tip-arrow-bottom tip-arrow-left"
;
this
.
asyncAnimating
=
false
},
update
:
function
(
j
,
k
){
if
(
this
.
disabled
){
return
}
var
i
=
j
!==
undefined
;
if
(
i
){
if
(
!
k
){
this
.
opts
.
content
=
j
}
if
(
!
this
.
$tip
.
data
(
"active"
)){
return
}}
else
{
j
=
this
.
opts
.
content
}
var
h
=
this
,
g
=
typeof
j
==
"function"
?
j
.
call
(
this
.
$elm
[
0
],
function
(
l
){
h
.
update
(
l
)}):
j
==
"[title]"
?
this
.
$elm
.
data
(
"title.poshytip"
):
j
;
if
(
this
.
content
!==
g
){
this
.
$inner
.
empty
().
append
(
g
);
this
.
content
=
g
}
this
.
refresh
(
i
)},
refresh
:
function
(
h
){
if
(
this
.
disabled
){
return
}
if
(
h
){
if
(
!
this
.
$tip
.
data
(
"active"
)){
return
}
var
k
=
{
left
:
this
.
$tip
.
css
(
"left"
),
top
:
this
.
$tip
.
css
(
"top"
)}}
this
.
$tip
.
css
({
left
:
0
,
top
:
0
}).
appendTo
(
document
.
body
);
if
(
this
.
opacity
===
undefined
){
this
.
opacity
=
this
.
$tip
.
css
(
"opacity"
)}
var
l
=
this
.
$tip
.
css
(
"background-image"
).
match
(
d
),
m
=
this
.
$arrow
.
css
(
"background-image"
).
match
(
d
);
if
(
l
){
var
i
=
c
.
test
(
l
[
1
]);
if
(
b
&&
i
){
this
.
$tip
.
css
(
"background-image"
,
"none"
);
this
.
$inner
.
css
({
margin
:
0
,
border
:
0
,
padding
:
0
});
l
=
i
=
false
}
else
{
this
.
$tip
.
prepend
(
'<table class="tip-table" border="0" cellpadding="0" cellspacing="0"><tr><td class="tip-top tip-bg-image" colspan="2"><span></span></td><td class="tip-right tip-bg-image" rowspan="2"><span></span></td></tr><tr><td class="tip-left tip-bg-image" rowspan="2"><span></span></td><td></td></tr><tr><td class="tip-bottom tip-bg-image" colspan="2"><span></span></td></tr></table>'
).
css
({
border
:
0
,
padding
:
0
,
"background-image"
:
"none"
,
"background-color"
:
"transparent"
}).
find
(
".tip-bg-image"
).
css
(
"background-image"
,
'url("'
+
l
[
1
]
+
'")'
).
end
().
find
(
"td"
).
eq
(
3
).
append
(
this
.
$inner
)}
if
(
i
&&!
e
.
support
.
opacity
){
this
.
opts
.
fade
=
false
}}
if
(
m
&&!
e
.
support
.
opacity
){
if
(
b
&&
c
.
test
(
m
[
1
])){
m
=
false
;
this
.
$arrow
.
css
(
"background-image"
,
"none"
)}
this
.
opts
.
fade
=
false
}
var
o
=
this
.
$tip
.
find
(
"> table.tip-table"
);
if
(
b
){
this
.
$tip
[
0
].
style
.
width
=
""
;
o
.
width
(
"auto"
).
find
(
"td"
).
eq
(
3
).
width
(
"auto"
);
var
n
=
this
.
$tip
.
width
(),
j
=
parseInt
(
this
.
$tip
.
css
(
"min-width"
)),
g
=
parseInt
(
this
.
$tip
.
css
(
"max-width"
));
if
(
!
isNaN
(
j
)
&&
n
<
j
){
n
=
j
}
else
{
if
(
!
isNaN
(
g
)
&&
n
>
g
){
n
=
g
}}
this
.
$tip
.
add
(
o
).
width
(
n
).
eq
(
0
).
find
(
"td"
).
eq
(
3
).
width
(
"100%"
)}
else
{
if
(
o
[
0
]){
o
.
width
(
"auto"
).
find
(
"td"
).
eq
(
3
).
width
(
"auto"
).
end
().
end
().
width
(
document
.
defaultView
&&
document
.
defaultView
.
getComputedStyle
&&
parseFloat
(
document
.
defaultView
.
getComputedStyle
(
this
.
$tip
[
0
],
null
).
width
)
||
this
.
$tip
.
width
()).
find
(
"td"
).
eq
(
3
).
width
(
"100%"
)}}
this
.
tipOuterW
=
this
.
$tip
.
outerWidth
();
this
.
tipOuterH
=
this
.
$tip
.
outerHeight
();
this
.
calcPos
();
if
(
m
&&
this
.
pos
.
arrow
){
this
.
$arrow
[
0
].
className
=
"tip-arrow tip-arrow-"
+
this
.
pos
.
arrow
;
this
.
$arrow
.
css
(
"visibility"
,
"inherit"
)}
if
(
h
&&
this
.
opts
.
refreshAniDuration
){
this
.
asyncAnimating
=
true
;
var
p
=
this
;
this
.
$tip
.
css
(
k
).
animate
({
left
:
this
.
pos
.
l
,
top
:
this
.
pos
.
t
},
this
.
opts
.
refreshAniDuration
,
function
(){
p
.
asyncAnimating
=
false
})}
else
{
this
.
$tip
.
css
({
left
:
this
.
pos
.
l
,
top
:
this
.
pos
.
t
})}},
display
:
function
(
h
){
var
i
=
this
.
$tip
.
data
(
"active"
);
if
(
i
&&!
h
||!
i
&&
h
){
return
}
this
.
$tip
.
stop
();
if
((
this
.
opts
.
slide
&&
this
.
pos
.
arrow
||
this
.
opts
.
fade
)
&&
(
h
&&
this
.
opts
.
hideAniDuration
||!
h
&&
this
.
opts
.
showAniDuration
)){
var
n
=
{},
m
=
{};
if
(
this
.
opts
.
slide
&&
this
.
pos
.
arrow
){
var
l
,
g
;
if
(
this
.
pos
.
arrow
==
"bottom"
||
this
.
pos
.
arrow
==
"top"
){
l
=
"top"
;
g
=
"bottom"
}
else
{
l
=
"left"
;
g
=
"right"
}
var
k
=
parseInt
(
this
.
$tip
.
css
(
l
));
n
[
l
]
=
k
+
(
h
?
0
:(
this
.
pos
.
arrow
==
g
?
-
this
.
opts
.
slideOffset
:
this
.
opts
.
slideOffset
));
m
[
l
]
=
k
+
(
h
?(
this
.
pos
.
arrow
==
g
?
this
.
opts
.
slideOffset
:
-
this
.
opts
.
slideOffset
):
0
)
+
"px"
}
if
(
this
.
opts
.
fade
){
n
.
opacity
=
h
?
this
.
$tip
.
css
(
"opacity"
):
0
;
m
.
opacity
=
h
?
0
:
this
.
opacity
}
this
.
$tip
.
css
(
n
).
animate
(
m
,
this
.
opts
[
h
?
"hideAniDuration"
:
"showAniDuration"
])}
h
?
this
.
$tip
.
queue
(
e
.
proxy
(
this
.
reset
,
this
)):
this
.
$tip
.
css
(
"visibility"
,
"inherit"
);
if
(
i
){
var
j
=
this
.
$elm
.
data
(
"title.poshytip"
);
if
(
j
!==
null
){
this
.
$elm
.
attr
(
"title"
,
j
)}}
this
.
$tip
.
data
(
"active"
,
!
i
)},
disable
:
function
(){
this
.
reset
();
this
.
disabled
=
true
},
enable
:
function
(){
this
.
disabled
=
false
},
destroy
:
function
(){
this
.
reset
();
this
.
$tip
.
remove
();
delete
this
.
$tip
;
this
.
content
=
null
;
this
.
$elm
.
unbind
(
".poshytip"
).
removeData
(
"title.poshytip"
).
removeData
(
"poshytip"
);
a
.
splice
(
e
.
inArray
(
this
,
a
),
1
)},
clearTimeouts
:
function
(){
if
(
this
.
showTimeout
){
clearTimeout
(
this
.
showTimeout
);
this
.
showTimeout
=
0
}
if
(
this
.
hideTimeout
){
clearTimeout
(
this
.
hideTimeout
);
this
.
hideTimeout
=
0
}},
calcPos
:
function
(){
var
n
=
{
l
:
0
,
t
:
0
,
arrow
:
""
},
h
=
e
(
window
),
k
=
{
l
:
h
.
scrollLeft
(),
t
:
h
.
scrollTop
(),
w
:
h
.
width
(),
h
:
h
.
height
()},
p
,
j
,
m
,
i
,
q
,
g
;
if
(
this
.
opts
.
alignTo
==
"cursor"
){
p
=
j
=
m
=
this
.
eventX
;
i
=
q
=
g
=
this
.
eventY
}
else
{
var
o
=
this
.
$elm
.
offset
(),
l
=
{
l
:
o
.
left
,
t
:
o
.
top
,
w
:
this
.
$elm
.
outerWidth
(),
h
:
this
.
$elm
.
outerHeight
()};
p
=
l
.
l
+
(
this
.
opts
.
alignX
!=
"inner-right"
?
0
:
l
.
w
);
j
=
p
+
Math
.
floor
(
l
.
w
/
2
);
m
=
p
+
(
this
.
opts
.
alignX
!=
"inner-left"
?
l
.
w
:
0
);
i
=
l
.
t
+
(
this
.
opts
.
alignY
!=
"inner-bottom"
?
0
:
l
.
h
);
q
=
i
+
Math
.
floor
(
l
.
h
/
2
);
g
=
i
+
(
this
.
opts
.
alignY
!=
"inner-top"
?
l
.
h
:
0
)}
switch
(
this
.
opts
.
alignX
){
case
"right"
:
case
"inner-left"
:
n
.
l
=
m
+
this
.
opts
.
offsetX
;
if
(
this
.
opts
.
keepInViewport
&&
n
.
l
+
this
.
tipOuterW
>
k
.
l
+
k
.
w
){
n
.
l
=
k
.
l
+
k
.
w
-
this
.
tipOuterW
}
if
(
this
.
opts
.
alignX
==
"right"
||
this
.
opts
.
alignY
==
"center"
){
n
.
arrow
=
"left"
}
break
;
case
"center"
:
n
.
l
=
j
-
Math
.
floor
(
this
.
tipOuterW
/
2
);
if
(
this
.
opts
.
keepInViewport
){
if
(
n
.
l
+
this
.
tipOuterW
>
k
.
l
+
k
.
w
){
n
.
l
=
k
.
l
+
k
.
w
-
this
.
tipOuterW
}
else
{
if
(
n
.
l
<
k
.
l
){
n
.
l
=
k
.
l
}}}
break
;
default
:
n
.
l
=
p
-
this
.
tipOuterW
-
this
.
opts
.
offsetX
;
if
(
this
.
opts
.
keepInViewport
&&
n
.
l
<
k
.
l
){
n
.
l
=
k
.
l
}
if
(
this
.
opts
.
alignX
==
"left"
||
this
.
opts
.
alignY
==
"center"
){
n
.
arrow
=
"right"
}}
switch
(
this
.
opts
.
alignY
){
case
"bottom"
:
case
"inner-top"
:
n
.
t
=
g
+
this
.
opts
.
offsetY
;
if
(
!
n
.
arrow
||
this
.
opts
.
alignTo
==
"cursor"
){
n
.
arrow
=
"top"
}
if
(
this
.
opts
.
keepInViewport
&&
n
.
t
+
this
.
tipOuterH
>
k
.
t
+
k
.
h
){
n
.
t
=
i
-
this
.
tipOuterH
-
this
.
opts
.
offsetY
;
if
(
n
.
arrow
==
"top"
){
n
.
arrow
=
"bottom"
}}
break
;
case
"center"
:
n
.
t
=
q
-
Math
.
floor
(
this
.
tipOuterH
/
2
);
if
(
this
.
opts
.
keepInViewport
){
if
(
n
.
t
+
this
.
tipOuterH
>
k
.
t
+
k
.
h
){
n
.
t
=
k
.
t
+
k
.
h
-
this
.
tipOuterH
}
else
{
if
(
n
.
t
<
k
.
t
){
n
.
t
=
k
.
t
}}}
break
;
default
:
n
.
t
=
i
-
this
.
tipOuterH
-
this
.
opts
.
offsetY
;
if
(
!
n
.
arrow
||
this
.
opts
.
alignTo
==
"cursor"
){
n
.
arrow
=
"bottom"
}
if
(
this
.
opts
.
keepInViewport
&&
n
.
t
<
k
.
t
){
n
.
t
=
g
+
this
.
opts
.
offsetY
;
if
(
n
.
arrow
==
"bottom"
){
n
.
arrow
=
"top"
}}}
this
.
pos
=
n
}};
e
.
fn
.
poshytip
=
function
(
h
){
if
(
typeof
h
==
"string"
){
var
g
=
arguments
,
l
=
h
;
Array
.
prototype
.
shift
.
call
(
g
);
if
(
l
==
"destroy"
){
this
.
die
?
this
.
die
(
"mouseenter.poshytip"
).
die
(
"focus.poshytip"
):
e
(
document
).
undelegate
(
this
.
selector
,
"mouseenter.poshytip"
).
undelegate
(
this
.
selector
,
"focus.poshytip"
)}
return
this
.
each
(
function
(){
var
m
=
e
(
this
).
data
(
"poshytip"
);
if
(
m
&&
m
[
l
]){
m
[
l
].
apply
(
m
,
g
)}})}
var
j
=
e
.
extend
({},
e
.
fn
.
poshytip
.
defaults
,
h
);
if
(
!
e
(
"#poshytip-css-"
+
j
.
className
)[
0
]){
e
([
'<style id="poshytip-css-'
,
j
.
className
,
'" type="text/css">'
,
"div."
,
j
.
className
,
"{visibility:hidden;position:absolute;top:0;left:0;}"
,
"div."
,
j
.
className
,
" table.tip-table, div."
,
j
.
className
,
" table.tip-table td{margin:0;font-family:inherit;font-size:inherit;font-weight:inherit;font-style:inherit;font-variant:inherit;vertical-align:middle;}"
,
"div."
,
j
.
className
,
" td.tip-bg-image span{display:block;font:1px/1px sans-serif;height:"
,
j
.
bgImageFrameSize
,
"px;width:"
,
j
.
bgImageFrameSize
,
"px;overflow:hidden;}"
,
"div."
,
j
.
className
,
" td.tip-right{background-position:100% 0;}"
,
"div."
,
j
.
className
,
" td.tip-bottom{background-position:100% 100%;}"
,
"div."
,
j
.
className
,
" td.tip-left{background-position:0 100%;}"
,
"div."
,
j
.
className
,
" div.tip-inner{background-position:-"
,
j
.
bgImageFrameSize
,
"px -"
,
j
.
bgImageFrameSize
,
"px;}"
,
"div."
,
j
.
className
,
" div.tip-arrow{visibility:hidden;position:absolute;overflow:hidden;font:1px/1px sans-serif;}"
,
"</style>"
].
join
(
""
)).
appendTo
(
"head"
)}
if
(
j
.
liveEvents
&&
j
.
showOn
!=
"none"
){
var
i
,
k
=
e
.
extend
({},
j
,{
liveEvents
:
false
});
switch
(
j
.
showOn
){
case
"hover"
:
i
=
function
(){
var
m
=
e
(
this
);
if
(
!
m
.
data
(
"poshytip"
)){
m
.
poshytip
(
k
).
poshytip
(
"mouseenter"
)}};
this
.
live
?
this
.
live
(
"mouseenter.poshytip"
,
i
):
e
(
document
).
delegate
(
this
.
selector
,
"mouseenter.poshytip"
,
i
);
break
;
case
"focus"
:
i
=
function
(){
var
m
=
e
(
this
);
if
(
!
m
.
data
(
"poshytip"
)){
m
.
poshytip
(
k
).
poshytip
(
"showDelayed"
)}};
this
.
live
?
this
.
live
(
"focus.poshytip"
,
i
):
e
(
document
).
delegate
(
this
.
selector
,
"focus.poshytip"
,
i
);
break
}
return
this
}
return
this
.
each
(
function
(){
new
e
.
Poshytip
(
this
,
j
)})};
e
.
fn
.
poshytip
.
defaults
=
{
content
:
"[title]"
,
className
:
"tip-yellow"
,
bgImageFrameSize
:
10
,
showTimeout
:
500
,
hideTimeout
:
100
,
timeOnScreen
:
0
,
showOn
:
"hover"
,
liveEvents
:
false
,
alignTo
:
"cursor"
,
alignX
:
"right"
,
alignY
:
"top"
,
offsetX
:
-
22
,
offsetY
:
18
,
keepInViewport
:
true
,
allowTipHover
:
true
,
followCursor
:
false
,
fade
:
true
,
slide
:
true
,
slideOffset
:
8
,
showAniDuration
:
300
,
hideAniDuration
:
300
,
refreshAniDuration
:
200
}})(
jQuery
);
...
...
js/validate.js
0 → 100644
查看文件 @
1497f12
/*
* 常用的验证集合
* useage:if(validate.isemail(email)){...}else{....}
* last update 2015-07-29
*/
String
.
prototype
.
trim
=
function
(){
return
this
.
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
}
String
.
prototype
.
ltrim
=
function
(){
return
this
.
replace
(
/
(
^
\s
*
)
/g
,
""
);
}
String
.
prototype
.
rtrim
=
function
(){
return
this
.
replace
(
/
(\s
*$
)
/g
,
""
);
}
var
validate
=
{
//是否电话号码
isphone
:
function
(
value
)
{
var
patrn
=
/^
((\+?
86
)
|
(\(\+
86
\)))?\d{3,4}
-
\d{7,8}(
-
\d{3,4})?
$/
if
(
!
patrn
.
exec
(
value
))
return
false
return
true
},
//是否手机号码
iscellphone
:
function
(
value
)
{
var
validateReg
=
/^
((\+?
86
)
|
(\(\+
86
\)))?
1
\d{10}
$/
;
return
validateReg
.
test
(
value
);
},
//是否邮箱
isemail
:
function
(
value
){
var
emailRegex
=
/^
[
a-zA-Z0-9.!#$%&'*+
/
=?^_`{|}~-
]
+@
[
a-zA-Z0-9
](?:[
a-zA-Z0-9-
]{0,61}[
a-zA-Z0-9
])?(?:\.[
a-zA-Z0-9
](?:[
a-zA-Z0-9-
]{0,61}[
a-zA-Z0-9
])?)
*$/
;
return
emailRegex
.
test
(
value
);
},
//是否为空
isempty
:
function
(
value
){
if
(
value
.
length
==
0
)
return
true
return
false
;
},
//是否为18位身份证号码
id18
:
function
(
id
)
{
if
(
!
/
\d{17}[\d
xX
]
/
.
test
(
id
))
{
return
false
;
}
var
modcmpl
=
function
(
m
,
i
,
n
)
{
return
(
i
+
n
-
m
%
i
)
%
i
;
},
f
=
function
(
v
,
i
)
{
return
v
*
(
Math
.
pow
(
2
,
i
-
1
)
%
11
);
},
s
=
0
;
for
(
var
i
=
0
;
i
<
17
;
i
++
)
{
s
+=
f
(
+
id
.
charAt
(
i
),
18
-
i
);
}
var
c0
=
id
.
charAt
(
17
),
c1
=
modcmpl
(
s
,
11
,
1
);
return
c0
-
c1
===
0
||
(
c0
.
toLowerCase
()
===
'x'
&&
c1
===
10
);
},
//是否为15位身份证号码,2013年1月1日起停止使用
id15
:
function
(
id
)
{
var
pattern
=
/
[
1-9
]\d{5}(\d{2})(\d{2})(\d{2})\d{3}
/
;
matches
,
y
,
m
,
d
,
date
;
matches
=
id
.
match
(
pattern
);
y
=
+
(
'19'
+
matches
[
1
]);
m
=
+
matches
[
2
];
d
=
+
matches
[
3
];
date
=
new
Date
(
y
,
m
-
1
,
d
);
return
(
date
.
getFullYear
()
===
y
&&
date
.
getMonth
()
===
m
-
1
&&
date
.
getDate
()
===
d
);
},
//是否为IP地址
isip
:
function
(
ip
){
var
ipRegex
=
/^
((
25
[
0-5
]
|2
[
0-4
][
0-9
]
|1
[
0-9
]{2}
|
[
0-9
]{1,2})\.){3}(
25
[
0-5
]
|2
[
0-4
][
0-9
]
|1
[
0-9
]{2}
|
[
0-9
]{1,2})
$/i
;
return
ipRegex
.
test
(
ip
);
},
//是否为URL地址
isurl
:
function
(
url
){
var
urlRegex
=
/^
((
http|https
)
:
\/\/(\w
+:
{0,1}\w
*@
)?(\S
+
)
|
)(
:
[
0-9
]
+
)?(\/
|
\/([\w
#!:.?+=&%@!
\-\/]))?
$/
;
return
urlRegex
.
test
(
url
);
},
haschinese
:
function
(
value
){
var
patrn
=
/
[\u
4E00-
\u
9FA5
]
|
[\u
FE30-
\u
FFA0
]
/gi
;
if
(
!
patrn
.
exec
(
value
)){
return
false
;
}
else
{
return
true
;
}
}
}
...
...
productTrials.html
查看文件 @
1497f12
...
...
@@ -39,5 +39,89 @@
</div>
</div>
<script
type=
"text/javascript"
src=
"js/rem.js"
></script>
<script
type=
"text/javascript"
src=
"js/jquery.js"
></script>
<script
type=
"text/javascript"
src=
"js/jquery.poshytip.min.js"
></script>
<script
type=
"text/javascript"
src=
"js/validate.js"
></script>
<script>
$
(
document
).
ready
(
function
(){
$
(
'.submit_trail'
).
click
(
function
(){
var
obj
=
$
(
this
);
var
user_name
=
$
(
"input[name=user_name]"
).
val
();
var
phone_number
=
$
(
"input[name=phone_number]"
).
val
();
var
email
=
$
(
"input[name=email]"
).
val
();
var
company
=
$
(
"input[name=company]"
).
val
();
var
telphone
=
$
(
"input[name=telphone]"
).
val
();
// var clientip = returnCitySN["cip"];
if
(
validate
.
isempty
(
user_name
)){
$
(
"input[name=user_name]"
).
poshytip
({
className
:
'tip-yellowsimple'
,
showOn
:
'focus'
,
alignTo
:
'target'
,
alignX
:
'right'
,
alignY
:
'center'
,
offsetX
:
5
,
showTimeout
:
100
});
$
(
"input[name=user_name]"
).
focus
();
return
false
;
}
if
(
!
validate
.
iscellphone
(
phone_number
)){
$
(
"input[name=phone_number]"
).
poshytip
({
className
:
'tip-yellowsimple'
,
showOn
:
'focus'
,
alignTo
:
'target'
,
alignX
:
'right'
,
alignY
:
'center'
,
offsetX
:
5
,
showTimeout
:
100
});
$
(
"input[name=phone_number]"
).
focus
();
return
false
;
}
if
(
!
validate
.
isemail
(
email
)){
$
(
"input[name=email]"
).
poshytip
({
className
:
'tip-yellowsimple'
,
showOn
:
'focus'
,
alignTo
:
'target'
,
alignX
:
'right'
,
alignY
:
'center'
,
offsetX
:
5
,
showTimeout
:
100
});
$
(
"input[name=email]"
).
focus
();
return
false
;
}
jQuery
.
support
.
cors
=
true
;
$
.
ajax
({
url
:
"http://api.xuedianyun.com/sanmang/index.php/api/sendmail/sendmail"
,
type
:
'POST'
,
data
:{
email
:
email
,
user_name
:
user_name
,
phone_number
:
phone_number
,
company
:
company
,
telphone
:
telphone
},
dataType
:
'JSON'
,
success
:
function
(
res
){
if
(
res
.
errcode
==
0
){
$
(
'.info'
).
show
();
//alert("I am an alert box!!")
}
else
{
alert
(
res
.
msg
);
}
},
complete
:
function
(){
$
(
':input'
).
val
(
''
);
$
(
'.info'
).
slideToggle
(
2000
);
obj
.
empty
().
text
(
"立即申请"
);
alert
(
res
.
msg
);
}
});
})
});
</script>
</body>
</html>
\ No newline at end of file
...
...
请
注册
或
登录
后发表评论