Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !5287

Change setInterval to setTimeout in bootstrap-carousel.js

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/SamBenson/2.1.2-wip into 2.1.2-wip 12 years ago
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: SamBenson

The setInterval was firing immediately after the user click the "next" or "prev" buttons so it's been swapped for a setTimeout which is cleared and reset each time the carousel is manually slid.  

Compare
  • 2.1.2-wip (base)

and
  • latest version
    6d1e7c48
    1 commit, 2 years ago

1 file
+ 7
- 4

    Preferences

    File browser
    Compare changes
js/bootstrap-carousel.js
+ 7
- 4
  • View file @ 6d1e7c48


@@ -41,7 +41,7 @@
if (!e) this.paused = false
this.options.interval
&& !this.paused
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
&& (this.timeout = setTimeout($.proxy(this.next, this), this.options.interval))
return this
}
@@ -72,8 +72,8 @@
this.$element.trigger($.support.transition.end)
this.cycle()
}
clearInterval(this.interval)
this.interval = null
clearTimeout(this.timeout)
this.timeout = null
return this
}
@@ -90,7 +90,7 @@
, slide: function (type, next) {
var $active = this.$element.find('.item.active')
, $next = next || $active[type]()
, isCycling = this.interval
, isCycling = this.timeout
, direction = type == 'next' ? 'left' : 'right'
, fallback = type == 'next' ? 'first' : 'last'
, that = this
@@ -118,6 +118,9 @@
$active.removeClass(['active', direction].join(' '))
that.sliding = false
setTimeout(function () { that.$element.trigger('slid') }, 0)
clearTimeout(that.timeout)
that.timeout = setTimeout($.proxy(that.next, that), that.options.interval)
})
} else {
this.$element.trigger(e)
0 Assignees
None
Assign to
0 Reviewers
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
Lock merge request
Unlocked
participants
Reference:
Source branch: github/fork/SamBenson/2.1.2-wip