Feature Request/Implementation

Add option to show modal after user scrolls to a certain height on the page.

Proposed Resolution

Add option to show modal after X pixels scrolled or % of page.
Also configurable if modal should show up after activation threshold crosses start, center or end of the page.

CommentFileSizeAuthor
#5 3.png198.06 KBrenatog
#5 2.png80.59 KBrenatog
#5 1.png254.35 KBrenatog

Issue fork modal_page-3268990

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

luiscarvalho created an issue. See original summary.

luiscarvalho’s picture

Status: Active » Needs review
renatog’s picture

Assigned: luiscarvalho » renatog

I'm testing that

renatog’s picture

Issue summary: View changes
Status: Needs review » Needs work
StatusFileSize
new254.35 KB
new80.59 KB
new198.06 KB

Isn't working for me.

I put value: 50%

the modal is saved

But when I open again the value there is only "50" without "%"

so is considering pixels and not percent =/

luiscarvalho’s picture

Status: Needs work » Needs review

The field was saving only the numeric part because the schema was creating an integer on the database. Sending a fix.

renatog’s picture

Status: Needs review » Needs work

Continue not working for me =/

For you it's working with 50% on that field?

diegors’s picture

Assigned: renatog » diegors

I'll try to look into that.

diegors’s picture

Assigned: diegors » Unassigned
Status: Needs work » Needs review

Fixed the scroll problem based on scroll offset.

Now any offset type work from 0% to 100% scroll.

diegors’s picture

fixed the merge conflicts,

paulocs’s picture

Status: Needs review » Needs work

If the entire page is displayed on the screen (no scroll possibility), the modal is not displayed.

diegors’s picture

Assigned: Unassigned » diegors
diegors’s picture

Assigned: diegors » Unassigned
Status: Needs work » Needs review

Made the purposed change on #11, and now it checks if that page has a scrollbar, if not, then shows the modal automatically.

Also fixed the merge problem.

lucassc’s picture

Assigned: Unassigned » lucassc

Hi!

I will review.

lucassc’s picture

Assigned: lucassc » Unassigned
Status: Needs review » Needs work

- I confirm that "Height Offset" field is now considering pixels and percent values;

- The modal is displayed to entire pages (with no scroll possibility) as well;

- However, the modal appears twice if there's just a little space to scroll.

E.g., in a fresh installation of drupal with only the user "admin" registered, there is a scroll space of approximately 50px in the /admin/people page (in my monitor). In these cases, the modal appears twice (once when /admin/people get ready and another when scrolling).

diegors’s picture

Status: Needs work » Needs review

Thanks @lucassc, added a return to prevent the modal from appearing more than once.
Also changed the if statement comparing the document and window height.

-            if ($("body").height() <= $(window).height()) {
+            if ($(document).height() == $(window).height()) {
               modal.modal();
               $(document).off(namespace);
+              return;
             }
lucassc’s picture

Assigned: Unassigned » lucassc
lucassc’s picture

Assigned: lucassc » Unassigned
Status: Needs review » Reviewed & tested by the community

Looks good to me! Everything works.

I just fixed some coding standards errors introduced by the issue.

RTBC if no one else disagrees.

  • paulocs committed 191090d on 4.1.x authored by luiscarvalho
    Issue #3268990 by diegors, luiscarvalho, lucassc, RenatoG: Reimplement...
paulocs’s picture

Status: Reviewed & tested by the community » Fixed

Amazing work! Thank you all!

renatog’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.