Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
my-cucumbers-ru-github-io
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Лотуга Данила Сергеевич
my-cucumbers-ru-github-io
Commits
54a2d333
Commit
54a2d333
authored
Jul 31, 2011
by
Vadim Makeev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
basic support for touch devices; fixed bug with mobile safari
parent
25b9ac09
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
12 deletions
+34
-12
script.js
scripts/script.js
+34
-12
No files found.
scripts/script.js
View file @
54a2d333
...
...
@@ -80,6 +80,23 @@
updateProgress
(
slide_number
);
}
}
function
dispatchSingleSlideMode
(
e
)
{
if
(
'SECTION'
===
e
.
target
.
nodeName
&&
-
1
!==
e
.
target
.
parentNode
.
parentNode
.
className
.
indexOf
(
'slide'
)
&&
isSlideListMode
()
)
{
e
.
preventDefault
();
// NOTE: we should update hash to get things work properly
url
.
hash
=
'#'
+
e
.
target
.
parentNode
.
parentNode
.
id
;
history
.
replaceState
(
null
,
null
,
url
.
pathname
+
'?full#'
+
e
.
target
.
parentNode
.
parentNode
.
id
);
enterSingleSlideMode
();
updateProgress
(
getCurrentSlideNumber
());
}
}
window
.
addEventListener
(
'DOMContentLoaded'
,
function
()
{
if
(
!
isSlideListMode
())
{
...
...
@@ -193,20 +210,25 @@
}
},
false
);
document
.
addEventListener
(
'click'
,
function
(
e
)
{
if
(
'SECTION'
===
e
.
target
.
nodeName
&&
-
1
!==
e
.
target
.
parentNode
.
parentNode
.
className
.
indexOf
(
'slide'
)
&&
isSlideListMode
()
)
{
e
.
preventDefault
();
document
.
addEventListener
(
'click'
,
dispatchSingleSlideMode
,
false
);
document
.
addEventListener
(
'touchend'
,
dispatchSingleSlideMode
,
false
);
// NOTE: we should update hash to get things work properly
url
.
hash
=
'#'
+
e
.
target
.
parentNode
.
parentNode
.
id
;
history
.
replaceState
(
null
,
null
,
url
.
pathname
+
'?full#'
+
e
.
target
.
parentNode
.
parentNode
.
id
);
enterSingleSlideMode
();
document
.
addEventListener
(
'touchstart'
,
function
(
e
)
{
if
(
!
isSlideListMode
())
{
var
current_slide_number
=
getCurrentSlideNumber
(),
x
=
e
.
touches
[
0
].
pageX
;
if
(
x
>
window
.
innerWidth
/
2
)
{
current_slide_number
++
;
}
else
{
current_slide_number
--
;
}
goToSlide
(
current_slide_number
);
}
},
false
);
updateProgress
(
getCurrentSlideNumber
());
document
.
addEventListener
(
'touchmove'
,
function
(
e
)
{
if
(
!
isSlideListMode
())
{
e
.
preventDefault
();
}
},
false
);
...
...
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