Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Shelter Database
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
CHARISM
Shelter Database
Commits
82421138
Commit
82421138
authored
Sep 04, 2016
by
Maarten van der Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add swipe libs
parent
c701702e
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
0 deletions
+74
-0
src/web/static/js/hammer.min.js
src/web/static/js/hammer.min.js
+7
-0
src/web/static/js/swipe.js
src/web/static/js/swipe.js
+67
-0
No files found.
src/web/static/js/hammer.min.js
0 → 100644
View file @
82421138
This diff is collapsed.
Click to expand it.
src/web/static/js/swipe.js
0 → 100644
View file @
82421138
var
_swipe
=
{}
_swipe
.
container
=
document
.
getElementsByClassName
(
"
panes
"
).
length
?
document
.
getElementsByClassName
(
"
panes
"
)[
0
]
:
null
_swipe
.
dots
=
document
.
getElementsByClassName
(
"
dots
"
).
length
?
Array
.
prototype
.
slice
.
call
(
document
.
getElementsByClassName
(
"
dots
"
)[
0
].
children
,
0
)
:
null
;
_swipe
.
panes
=
Array
.
prototype
.
slice
.
call
(
_swipe
.
container
.
children
,
0
)
_swipe
.
containerSize
=
null
;
_swipe
.
currentIndex
=
0
;
dots
=
_swipe
.
show
=
function
(
showIndex
,
percent
,
animate
){
showIndex
=
Math
.
max
(
0
,
Math
.
min
(
showIndex
,
_swipe
.
panes
.
length
-
1
))
percent
=
showIndex
==
0
&&
percent
>
0
||
showIndex
==
_swipe
.
panes
.
length
-
1
&&
percent
<
0
?
percent
/
3
||
0
:
percent
||
0
var
className
=
_swipe
.
container
.
className
if
(
animate
)
{
if
(
className
.
indexOf
(
'
animate
'
)
===
-
1
)
{
_swipe
.
container
.
className
+=
'
animate
'
;
}
}
else
{
if
(
className
.
indexOf
(
'
animate
'
)
!==
-
1
)
{
_swipe
.
container
.
className
=
className
.
replace
(
'
animate
'
,
''
).
trim
()
}
}
var
paneIndex
,
pos
,
translate
for
(
paneIndex
=
0
;
paneIndex
<
_swipe
.
panes
.
length
;
paneIndex
++
)
{
pos
=
(
_swipe
.
containerSize
/
100
)
*
(((
paneIndex
-
showIndex
)
*
100
)
+
percent
)
translate
=
'
translate3d(
'
+
pos
+
'
px, 0, 0)
'
;
_swipe
.
panes
[
paneIndex
].
style
.
transform
=
translate
_swipe
.
panes
[
paneIndex
].
style
.
mozTransform
=
translate
_swipe
.
panes
[
paneIndex
].
style
.
webkitTransform
=
translate
}
// update Dots
for
(
var
i
=
0
;
i
<
_swipe
.
dots
.
length
;
i
++
){
_swipe
.
dots
[
i
].
className
=
"
dot
"
}
_swipe
.
dots
[
showIndex
].
className
=
"
dot selected
"
}
_swipe
.
onPan
=
function
(
ev
)
{
var
delta
=
ev
.
deltaX
;
var
percent
=
(
100
/
_swipe
.
containerSize
)
*
delta
;
var
animate
=
false
;
if
(
ev
.
type
==
'
panend
'
||
ev
.
type
==
'
pancancel
'
)
{
if
(
Math
.
abs
(
percent
)
>
20
&&
ev
.
type
==
'
panend
'
)
{
_swipe
.
currentIndex
+=
(
percent
<
0
)
?
1
:
-
1
;
}
percent
=
0
;
animate
=
true
;
}
_swipe
.
show
(
_swipe
.
currentIndex
,
percent
,
animate
)
}
_swipe
.
init
=
function
(
index
){
_swipe
.
setSize
()
var
mc
=
new
Hammer
(
_swipe
.
container
)
mc
.
on
(
"
panstart panmove panend pancancel
"
,
_swipe
.
onPan
)
_swipe
.
show
(
index
)
}
_swipe
.
setSize
=
function
(){
_swipe
.
containerSize
=
_swipe
.
container
.
offsetWidth
||
1000
}
_swipe
.
init
(
0
)
window
.
onresize
=
function
(
event
)
{
_swipe
.
setSize
()
}
\ No newline at end of file
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