最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

primeng splitbutton not display properly when screen width smaller than 960px - Stack Overflow

programmeradmin2浏览0评论

This issue can be found in Primeng18 official web link demo

the overlay is not directly under the button but under right bottom, and left a blank on the top

I have tried to give it a 'appendTo' to 'body' or itemitself or a fixed static element, neither of them work properly in all screen settings.

The basic requirement is like this, and for any cases, the overlay list should match the buttom of the target button, instead changed the whole layout and display in such a corner place... normal overlay

can any one know if there is a fix or some side work can fix this problem.

This issue can be found in Primeng18 official web link demo

the overlay is not directly under the button but under right bottom, and left a blank on the top

I have tried to give it a 'appendTo' to 'body' or itemitself or a fixed static element, neither of them work properly in all screen settings.

The basic requirement is like this, and for any cases, the overlay list should match the buttom of the target button, instead changed the whole layout and display in such a corner place... normal overlay

can any one know if there is a fix or some side work can fix this problem.

Share Improve this question edited Mar 31 at 9:28 John asked Mar 31 at 8:37 JohnJohn 191 gold badge1 silver badge4 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

by checking the source code, there is a breakpoint action of for the tieredmenu causing this issue since splitebutton using it as the overlay.

To follow the issue: https://github/primefaces/primeng/issues/17750

The root cause is in tieredmenu, the small size style (mobile style) is changing the overlay container position from absolute to relative.
when screen width is large than breakpoint, the container style is .p-tieredmenu-overlay {position: absolute;}
then width is smaller than the breakpoint .p-tieredmenu-mobile {position: relative;} will be added and take the priority.

The current solution could be:

  • add below style to your theme or global style, then it won't be overwritten to relative

    .p-tieredmenu.p-tieredmenu-overlay{
         position: absolute;
    }
    
  • If you want to have the control of the 'breakpoint', the source code change of splitbutton could be: code change

发布评论

评论列表(0)

  1. 暂无评论