WordPress.org

Forums

[resolved] Move popup comments window> (4 posts)

  1. Doodlebee
    Member
    Posted 9 years ago #

    By default, the popup comments window is in the center/top of the browser window.

    Is there a way I can move it, so when the user clicks the "comments" link, the window will pop up elsewhere? I just want it moved *down* from the top about 200px or so. I tried adding integers to the call-in script ("<?php comments_popup_script(400, 400); ?>" - "400" and "400" being the width and height of the window) but *that* was a mistake. I'd like to know if there's a "left" and "right" attribute somewhere I can pop in there.

    Any ideas? Thanks :)

  2. red-star
    Member
    Posted 9 years ago #

    You can at some CSS rules in your CSS file for the popup window!

  3. Doodlebee
    Member
    Posted 9 years ago #

    I realize I can use CSS to edit the presentation of the files - but the question I'm asking would involve the javascript. I currently have a popup javascript that would do what I want done - but I'd rather just go ahead and use the script that comes with wordpress.

    As far as I know, you can't usee CSS to position a new window. Divs, yes - tables, yes - popup windows? Never heard of such a thing. The position of the window itself would reply on the javascript in question - not the CSS.

  4. Doodlebee
    Member
    Posted 9 years ago #

    Gotcha! I figured it out. In case anyone else needs to know in the future - you need to find your "comment_functions.php" file (located in the "wp-includes" folder).

    Within that file, you need to locate the "comments_popup_script" area. You will see two lines that need to be changed:

    1)function comments_popup_script($width=400, $height=400, $file='') {

    simply add in the "left" and "top" attributes, like so:

    function comments_popup_script($width=400, $height=400, $left=200, $top=200, $file='') {

    2) find this line:

    window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}

    and add in the $left and $top again, like so:

    window.open(macagna, '_blank', 'width=$width,height=$height,left=$left,top=$top,scrollbars=yes,status=yes');\n}

    Voila! You can now position your popup window by adding in two more attributes in the php call mentioned above. Very nice.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.