• Resolved DeirdreBunny

    (@deirdrebunny)


    Greetings,

    First, I have been looking for something like this for a long time now, and I am pleased with the results – however, I have one concern/question regarding the position of the popup pox:

    One of my popup links is near the top of my page, in the WordPress Header. When I click on it, the popup opens in the center of the screen as expected, and looks great. The problem I am having is with scrolling. If I load my website, then scroll down a bit – just enough to where my link is still visible – and then click on the popup link, the popup then window appears at the bottom of the browser window and the bottom half is cut off. If I try to scroll up or down, the pop up remains static (while the rest of the site will scroll up or down as usual).

    My question is: How can I edit the files to ensure that no matter where I click the popup link from, that it will always open in the center of the browser?

    https://www.ads-software.com/extend/plugins/anything-popup/

    Resolved: see post below

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter DeirdreBunny

    (@deirdrebunny)

    Well, I think I found the answer – I had to edit:

    wp-content/plugins/anything-popup/anything-popup.js

    This was mentioned in another thread, but I didn’t think it would address the scrolling issue, but apparently it has.

    I’ll go over it in case anyone else has a similar issue:

    In “wp-content/plugins/anything-popup/anything-popup.js” look for the following code:

    formdiv.style.top = pt.y + "px";
        formdiv.style.left = pt.x + "px";
    
    	//formdiv.style.top = "200px";
        //formdiv.style.left = "550px";

    You need to remark out the top 2 lines, and then make the bottom two strings active, like so:

    //formdiv.style.top = pt.y + "px";
        //formdiv.style.left = pt.x + "px";
    
    	formdiv.style.top = "200px";
        formdiv.style.left = "550px";

    The popup positioning is based on the set pop up height and width (which you create in the “Anything Popup” section under Settings) so you may have to play around with those numbers. For example, my popups have a height of 400px and a width of 600px, so my code looks like this:

    //formdiv.style.top = pt.y + "px";
        //formdiv.style.left = pt.x + "px";
    
    	formdiv.style.top = "100px";
        formdiv.style.left = "350px";

    This positions the popup window in center of my browser, regardless of whether the main window is scrolled or not.

    ian.t.price

    (@iantpricegmailcom)

    Not actually a resolution but a workaround.

    I used the same one ??

    There seems to be an issue when calculating the offset in scrolled windows. my workaround looks like this.

    //_x = ((this.size().width-hWnd.width)/2)+offsetX;
    //_y = ((this.size().height-hWnd.height)/2)+offsetY;
      _x = ((this.size().width-hWnd.width)/2);
      _y = ((this.size().height-hWnd.height)/2);
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Position of pop up changes when window is scrolled’ is closed to new replies.