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

Forms cut off when on mobile

programmeradmin3浏览0评论

A form, which is generated by a credit card processor is loaded via javascript. The form works fine when loaded normally can be seen here, but mobile users see the below and are unable to scroll. Supposedly the form has a mobile version but that is apparently failing to load?

The form is loaded onto the page using:

<div id="bbox-root"></div>
<script type="text/javascript">
       window.bboxInit = function () {
           bbox.showForm('313b-e4b8cefad90c');
       };
       (function () {
           var e = document.createElement('script'); e.async = true;
           e.src = '.js';
           document.getElementsByTagName('head')[0].appendChild(e);
       } ());
</script>

I suspect that the theme of the site is somehow interacting with the form and causing the issue, but I'm not sure how to 1)diagnose that issue 2)remedy it without just stripping the CSS for the whole site.

A form, which is generated by a credit card processor is loaded via javascript. The form works fine when loaded normally can be seen here, but mobile users see the below and are unable to scroll. Supposedly the form has a mobile version but that is apparently failing to load?

The form is loaded onto the page using:

<div id="bbox-root"></div>
<script type="text/javascript">
       window.bboxInit = function () {
           bbox.showForm('313b-e4b8cefad90c');
       };
       (function () {
           var e = document.createElement('script'); e.async = true;
           e.src = 'https://bbox.blackbaudhosting/webforms/bbox-min.js';
           document.getElementsByTagName('head')[0].appendChild(e);
       } ());
</script>

I suspect that the theme of the site is somehow interacting with the form and causing the issue, but I'm not sure how to 1)diagnose that issue 2)remedy it without just stripping the CSS for the whole site.

Share Improve this question edited Apr 15, 2020 at 20:08 JFarq asked Apr 15, 2020 at 19:31 JFarqJFarq 32 bronze badges 3
  • Can you explain how the form is added? Is it via plugin, is an iFrame, does it have different stylesheets for mobile vs. desktop. Screen grabs are great for relaying what the issue is, but providing code snippets and details about what generates problematic code is necessary for anyone to provide you with an actual answer to address your issue. – Tony Djukic Commented Apr 15, 2020 at 19:58
  • Of course. I edited the main post to include some additional context that is hopefully helpful. – JFarq Commented Apr 15, 2020 at 20:08
  • Answered and I added some screen captures. – Tony Djukic Commented Apr 15, 2020 at 20:27
Add a comment  | 

1 Answer 1

Reset to default 0

That's a Blackbaud form and I've generally had a bit of trouble with them working on mobile and getting styled just right. Glad to see they've moved away from using iFrames at least.

Anyway, when I check the developer tools there is an element ID'd as #bbox-root.

The CSS for that element has a width declaration of 660px. So it's forcing it to be larger than an actual iPhone screen of 414px or 320px which then puts about half of it off screen.

Looks like you're on SiteGround and the style rule is located in this file: https://givesaintagnes/wp-content/uploads/siteground-optimizer-assets/siteground-optimizer-combined-styles-cb7027cddb8bea4cb7f4e68f2840e46a.min.css

So basically, assuming you can't actually edit that file as it's generated via their Optimizer plugin, you'll need to find that line in your CSS and edit it. I'd recommend, assuming the 660px was specified for a reason, the following:

#bbox-root{
     width:100%;
     max-width:660px;
}

That'll make sure the element only hits 100% on smaller screens and on larger screens will constrain the width to 660px.

Additionally you're going to have to write a series of other CSS rules to address how the other elements within that container are getting compressed and misplaced because of the smaller container size.

Here's where, in the developer console, I tested my solution:

And here's what it looks like:

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论