install bootstrap version 4.6 code example
Example: bootstrap 4.6
$('[data-spy="scroll"]').each(function () {
var $spy = $(this).scrollspy('refresh')
})
$('[data-spy="scroll"]').each(function () {
var $spy = $(this).scrollspy('refresh')
})