File tree Expand file tree Collapse file tree 2 files changed +99
-96
lines changed Expand file tree Collapse file tree 2 files changed +99
-96
lines changed Original file line number Diff line number Diff line change @@ -487,8 +487,15 @@ const inject = {
487487 }
488488
489489 if ( cfg . scroll && cfg . scroll !== "none" ) {
490+ // Get the scroll target for
491+ // 1) finding the scroll container
492+ // 2) getting the scroll offset (if not "top" or "target")
493+ const scroll_target = [ "top" , "target" ] . includes ( cfg . scroll )
494+ ? cfg . $target [ 0 ]
495+ : $ ( cfg . scroll , $injected ) [ 0 ] ;
496+
490497 const scroll_container = dom . find_scroll_container (
491- cfg . $target [ 0 ] ,
498+ scroll_target ,
492499 null ,
493500 window
494501 ) ;
@@ -498,11 +505,6 @@ const inject = {
498505 let left = 0 ;
499506
500507 if ( cfg . scroll !== "top" ) {
501- const scroll_target =
502- cfg . scroll === "target"
503- ? cfg . $target [ 0 ]
504- : $injected . filter ( cfg . scroll ) [ 0 ] ;
505-
506508 // Get the reference element to which against we calculate
507509 // the relative position of the target.
508510 // In case of a scroll container of window, we do not have
You can’t perform that action at this time.
0 commit comments