Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
373a5418
Commit
373a5418
authored
13 years ago
by
Jacob Thornton
Browse files
Options
Download
Email Patches
Plain Diff
add ability to cycle carousel to a particular frame
parent
6e490628
9 merge requests
!1475
2.0 wip
,
!1403
warningText and warningBackground docs fix
,
!1351
2.0 wip - relative font sizes
,
!1315
[2.0-wip] Fix mustache glob when building
,
!1268
[wip-2.0] IE 7/8 Typehead JS fix
,
!1236
2.0 wip - Fix for issue #1202
,
!1219
Removed dotted outline on navbar dropdown menu
,
!1210
Missing icon class from examples
,
!1195
Fixed display of secondary container
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/javascript.html
+2
-0
docs/javascript.html
js/bootstrap-carousel.js
+27
-5
js/bootstrap-carousel.js
with
29 additions
and
5 deletions
+29
-5
docs/javascript.html
+
2
-
0
View file @
373a5418
...
@@ -1323,6 +1323,8 @@ $('.myCarousel').carousel({
...
@@ -1323,6 +1323,8 @@ $('.myCarousel').carousel({
<p>
Cycles through the carousel items from left to right.
</p>
<p>
Cycles through the carousel items from left to right.
</p>
<h4>
.carousel('pause')
</h4>
<h4>
.carousel('pause')
</h4>
<p>
Stops the carousel from cycling through items.
</p>
<p>
Stops the carousel from cycling through items.
</p>
<h4>
.carousel(number)
</h4>
<p>
Cycles the carousel to a particular frame (0 based, similar to an array).
</p>
<h4>
.carousel('prev')
</h4>
<h4>
.carousel('prev')
</h4>
<p>
Cycles to the previous item.
</p>
<p>
Cycles to the previous item.
</p>
<h4>
.carousel('next')
</h4>
<h4>
.carousel('next')
</h4>
...
...
This diff is collapsed.
Click to expand it.
js/bootstrap-carousel.js
+
27
-
5
View file @
373a5418
...
@@ -38,6 +38,27 @@
...
@@ -38,6 +38,27 @@
return
this
return
this
}
}
,
to
:
function
(
pos
)
{
var
$active
=
this
.
$element
.
find
(
'
.active
'
)
,
children
=
$active
.
parent
().
children
()
,
activePos
=
children
.
index
(
$active
)
,
that
=
this
if
(
pos
>
(
children
.
length
-
1
)
||
pos
<
0
)
return
if
(
this
.
sliding
)
{
return
this
.
$element
.
one
(
'
slid
'
,
function
()
{
that
.
to
(
pos
)
})
}
if
(
activePos
==
pos
)
{
return
this
.
pause
().
cycle
()
}
return
this
.
slide
(
pos
>
activePos
?
'
next
'
:
'
prev
'
,
$
(
children
[
pos
]))
}
,
pause
:
function
()
{
,
pause
:
function
()
{
clearInterval
(
this
.
interval
)
clearInterval
(
this
.
interval
)
return
this
return
this
...
@@ -53,9 +74,9 @@
...
@@ -53,9 +74,9 @@
return
this
.
slide
(
'
prev
'
)
return
this
.
slide
(
'
prev
'
)
}
}
,
slide
:
function
(
type
)
{
,
slide
:
function
(
type
,
next
)
{
var
$active
=
this
.
$element
.
find
(
'
.active
'
)
var
$active
=
this
.
$element
.
find
(
'
.active
'
)
,
$next
=
$active
[
type
]()
,
$next
=
next
||
$active
[
type
]()
,
isCycling
=
this
.
interval
,
isCycling
=
this
.
interval
,
direction
=
type
==
'
next
'
?
'
left
'
:
'
right
'
,
direction
=
type
==
'
next
'
?
'
left
'
:
'
right
'
,
fallback
=
type
==
'
next
'
?
'
first
'
:
'
last
'
,
fallback
=
type
==
'
next
'
?
'
first
'
:
'
last
'
...
@@ -71,8 +92,8 @@
...
@@ -71,8 +92,8 @@
this
.
$element
.
trigger
(
'
slide
'
)
this
.
$element
.
trigger
(
'
slide
'
)
$active
.
removeClass
(
'
active
'
)
$active
.
removeClass
(
'
active
'
)
$next
.
addClass
(
'
active
'
)
$next
.
addClass
(
'
active
'
)
this
.
$element
.
trigger
(
'
slid
'
)
this
.
sliding
=
false
this
.
sliding
=
false
this
.
$element
.
trigger
(
'
slid
'
)
}
else
{
}
else
{
$next
.
addClass
(
type
)
$next
.
addClass
(
type
)
$next
[
0
].
offsetWidth
// force reflow
$next
[
0
].
offsetWidth
// force reflow
...
@@ -82,8 +103,8 @@
...
@@ -82,8 +103,8 @@
this
.
$element
.
one
(
$
.
support
.
transition
.
end
,
function
()
{
this
.
$element
.
one
(
$
.
support
.
transition
.
end
,
function
()
{
$next
.
removeClass
([
type
,
direction
].
join
(
'
'
)).
addClass
(
'
active
'
)
$next
.
removeClass
([
type
,
direction
].
join
(
'
'
)).
addClass
(
'
active
'
)
$active
.
removeClass
([
'
active
'
,
direction
].
join
(
'
'
))
$active
.
removeClass
([
'
active
'
,
direction
].
join
(
'
'
))
that
.
$element
.
trigger
(
'
slid
'
)
that
.
sliding
=
false
that
.
sliding
=
false
setTimeout
(
function
()
{
that
.
$element
.
trigger
(
'
slid
'
)
},
0
)
})
})
}
}
...
@@ -104,7 +125,8 @@
...
@@ -104,7 +125,8 @@
,
data
=
$this
.
data
(
'
carousel
'
)
,
data
=
$this
.
data
(
'
carousel
'
)
,
options
=
typeof
option
==
'
object
'
&&
option
,
options
=
typeof
option
==
'
object
'
&&
option
if
(
!
data
)
$this
.
data
(
'
carousel
'
,
(
data
=
new
Carousel
(
this
,
options
)))
if
(
!
data
)
$this
.
data
(
'
carousel
'
,
(
data
=
new
Carousel
(
this
,
options
)))
if
(
typeof
option
==
'
string
'
||
(
option
=
options
.
slide
))
data
[
option
]()
if
(
typeof
option
==
'
number
'
)
data
.
to
(
option
)
else
if
(
typeof
option
==
'
string
'
||
(
option
=
options
.
slide
))
data
[
option
]()
else
data
.
cycle
()
else
data
.
cycle
()
})
})
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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
Menu
Explore
Projects
Groups
Snippets