Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
e216243a
Commit
e216243a
authored
Jan 05, 2009
by
Ariel Flesler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jquery fx: Shortening the code additions on [6037].
parent
558d03f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
fx.js
src/fx.js
+17
-12
No files found.
src/fx.js
View file @
e216243a
var
elemdisplay
=
{},
var
elemdisplay
=
{},
fxHeight
=
[
"height"
,
"marginTop"
,
"marginBottom"
,
"paddingTop"
,
"paddingBottom"
],
fxAttrs
=
[
fxWidth
=
[
"width"
,
"marginLeft"
,
"marginRight"
,
"paddingLeft"
,
"paddingRight"
],
// height animations
fxOpacity
=
[
"opacity"
];
[
"height"
,
"marginTop"
,
"marginBottom"
,
"paddingTop"
,
"paddingBottom"
],
// width animations
function
genFx
(
type
,
width
,
height
,
extra
){
[
"width"
,
"marginLeft"
,
"marginRight"
,
"paddingLeft"
,
"paddingRight"
],
// opacity animations
[
"opacity"
]
];
function
genFx
(
type
,
num
){
var
obj
=
{};
var
obj
=
{};
jQuery
.
each
(
width
.
concat
(
height
||
[],
extra
||
[]
),
function
(){
jQuery
.
each
(
fxAttrs
.
concat
.
apply
([],
fxAttrs
.
slice
(
0
,
num
)
),
function
(){
obj
[
this
]
=
type
;
obj
[
this
]
=
type
;
});
});
return
obj
;
return
obj
;
...
@@ -14,7 +19,7 @@ function genFx( type, width, height, extra ){
...
@@ -14,7 +19,7 @@ function genFx( type, width, height, extra ){
jQuery
.
fn
.
extend
({
jQuery
.
fn
.
extend
({
show
:
function
(
speed
,
callback
){
show
:
function
(
speed
,
callback
){
if
(
speed
)
{
if
(
speed
)
{
return
this
.
animate
(
genFx
(
"show"
,
fxHeight
,
fxWidth
,
fxOpacity
),
speed
,
callback
);
return
this
.
animate
(
genFx
(
"show"
,
3
),
speed
,
callback
);
}
else
{
}
else
{
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
){
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
){
var
old
=
jQuery
.
data
(
this
[
i
],
"olddisplay"
);
var
old
=
jQuery
.
data
(
this
[
i
],
"olddisplay"
);
...
@@ -48,7 +53,7 @@ jQuery.fn.extend({
...
@@ -48,7 +53,7 @@ jQuery.fn.extend({
hide
:
function
(
speed
,
callback
){
hide
:
function
(
speed
,
callback
){
if
(
speed
)
{
if
(
speed
)
{
return
this
.
animate
(
genFx
(
"hide"
,
fxHeight
,
fxWidth
,
fxOpacity
),
speed
,
callback
);
return
this
.
animate
(
genFx
(
"hide"
,
3
),
speed
,
callback
);
}
else
{
}
else
{
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
){
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
){
var
old
=
jQuery
.
data
(
this
[
i
],
"olddisplay"
);
var
old
=
jQuery
.
data
(
this
[
i
],
"olddisplay"
);
...
@@ -73,7 +78,7 @@ jQuery.fn.extend({
...
@@ -73,7 +78,7 @@ jQuery.fn.extend({
var
state
=
bool
?
fn
:
jQuery
(
this
).
is
(
":hidden"
);
var
state
=
bool
?
fn
:
jQuery
(
this
).
is
(
":hidden"
);
jQuery
(
this
)[
state
?
"show"
:
"hide"
]();
jQuery
(
this
)[
state
?
"show"
:
"hide"
]();
})
:
})
:
this
.
animate
(
genFx
(
"toggle"
,
fxHeight
,
fxWidth
,
fxOpacity
),
fn
,
fn2
);
this
.
animate
(
genFx
(
"toggle"
,
3
),
fn
,
fn2
);
},
},
fadeTo
:
function
(
speed
,
to
,
callback
){
fadeTo
:
function
(
speed
,
to
,
callback
){
...
@@ -170,9 +175,9 @@ jQuery.fn.extend({
...
@@ -170,9 +175,9 @@ jQuery.fn.extend({
// Generate shortcuts for custom animations
// Generate shortcuts for custom animations
jQuery
.
each
({
jQuery
.
each
({
slideDown
:
genFx
(
"show"
,
fxHeight
),
slideDown
:
genFx
(
"show"
,
1
),
slideUp
:
genFx
(
"hide"
,
fxHeight
),
slideUp
:
genFx
(
"hide"
,
1
),
slideToggle
:
genFx
(
"toggle"
,
fxHeight
),
slideToggle
:
genFx
(
"toggle"
,
1
),
fadeIn
:
{
opacity
:
"show"
},
fadeIn
:
{
opacity
:
"show"
},
fadeOut
:
{
opacity
:
"hide"
}
fadeOut
:
{
opacity
:
"hide"
}
},
function
(
name
,
props
){
},
function
(
name
,
props
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment