8000 check affix pos on clicks - use timeout for clicks which scroll · rusongyu/bootstrap@0540b63 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0540b63

Browse files
committed
check affix pos on clicks - use timeout for clicks which scroll
1 parent aec8b08 commit 0540b63

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

docs/assets/js/bootstrap-affix.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828

2929
var Affix = function (element, options) {
3030
this.options = $.extend({}, $.fn.affix.defaults, options)
31-
this.$window = $(window).on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
31+
this.$window = $(window)
32+
.on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
33+
.on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
3234
this.$element = $(element)
3335
this.checkPosition()
3436
}

docs/assets/js/bootstrap.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1955,7 +1955,9 @@
19551955

19561956
var Affix = function (element, options) {
19571957
this.options = $.extend({}, $.fn.affix.defaults, options)
1958-
this.$window = $(window).on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
1958+
this.$window = $(window)
1959+
.on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
1960+
.on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
19591961
this.$element = $(element)
19601962
this.checkPosition()
19611963
}

0 commit comments

Comments
 (0)
0