Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
bootstrap
Commits
c37c1a67
Commit
c37c1a67
authored
Sep 16, 2014
by
Heinrich Fenkart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only enable `pause: hover` for non-touch browsers
Fixes #11967.
parent
4a3931d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
js/carousel.js
js/carousel.js
+1
-1
js/tests/unit/carousel.js
js/tests/unit/carousel.js
+22
-0
No files found.
js/carousel.js
View file @
c37c1a67
...
...
@@ -23,7 +23,7 @@
this
.
$active
=
this
.
$items
=
null
this
.
options
.
pause
==
'
hover
'
&&
this
.
$element
this
.
options
.
pause
==
'
hover
'
&&
!
(
'
ontouchstart
'
in
document
.
documentElement
)
&&
this
.
$element
.
on
(
'
mouseenter.bs.carousel
'
,
$
.
proxy
(
this
.
pause
,
this
))
.
on
(
'
mouseleave.bs.carousel
'
,
$
.
proxy
(
this
.
cycle
,
this
))
}
...
...
js/tests/unit/carousel.js
View file @
c37c1a67
...
...
@@ -398,4 +398,26 @@ $(function () {
strictEqual
(
$template
.
find
(
'
.item
'
)[
1
],
$template
.
find
(
'
.active
'
)[
0
],
'
second item active
'
)
})
test
(
'
should only add mouseenter and mouseleave listeners when not on mobile
'
,
function
()
{
var
isMobile
=
'
ontouchstart
'
in
document
.
documentElement
var
templateHTML
=
'
<div id="myCarousel" class="carousel" data-interval="false" data-pause="hover">
'
+
'
<div class="carousel-inner">
'
+
'
<div id="first" class="item active">
'
+
'
<img alt="">
'
+
'
</div>
'
+
'
<div id="second" class="item">
'
+
'
<img alt="">
'
+
'
</div>
'
+
'
<div id="third" class="item">
'
+
'
<img alt="">
'
+
'
</div>
'
+
'
</div>
'
+
'
</div>
'
var
$template
=
$
(
templateHTML
).
bootstrapCarousel
()
$
.
each
([
'
mouseover
'
,
'
mouseout
'
],
function
(
i
,
type
)
{
strictEqual
(
type
in
$
.
_data
(
$template
[
0
],
'
events
'
),
!
isMobile
,
'
does
'
+
(
isMobile
?
'
not
'
:
''
)
+
'
listen for
'
+
type
+
'
events
'
)
})
})
})
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