admin管理员组文章数量:1384426
Current Behavior
I am using shepherdjs to build an app tour. Shepherdjs in turn uses floating-ui under the hood.
My problem is that the tour step is positioned too close to the screen edge, making it look unpolished.
Example (Current Behavior):
{
attachTo: {
element: '#top-menu-account-settings-menu-icon',
on: 'left',
},
buttons: [
{
action: addLocationTour.next,
text: 'Next',
},
],
floatingUIOptions: {
middleware: [
offset(12), // Offset from the highlighted element
],
},
modalOverlayOpeningRadius: 5,
text: 'This step is attached to the bottom of the <code>.example-css-selector</code> element.',
},
Attempted Fix
I tried adding shift({ padding: 16 })
to floatingUIOptions
. This successfully prevented the step from touching the screen edge but also misaligned the arrow, shifting it downward and away from the icon center.
Example (Misaligned Arrow Issue):
{
attachTo: {
element: '#top-menu-account-settings-menu-icon',
on: 'left',
},
buttons: [
{
action: addLocationTour.next,
text: 'Next',
},
],
floatingUIOptions: {
middleware: [
offset(12), // Offset from the highlighted element
shift({ padding: 16 }), // Prevents tour from touching screen edges but shifts the arrow
],
},
modalOverlayOpeningRadius: 5,
text: 'This step is attached to the bottom of the <code>.example-css-selector</code> element.',
},
Question
How can I prevent the step from touching the screen edge without affecting the arrow alignment?
版权声明:本文标题:javascript - Shepherd.js: Add Padding Between Tour Step and Screen Edge Without Shifting Arrow? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744483307a2608298.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论