Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Error with Popup function

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #161805
    Chris Lowles
    Participant

    I am testing out a popup function and its not working, heres my sample.

    `
    /* Popup Plugin */
    function popup(url, w, h) {
    var left = (screen.width / 2) – (w / 2);
    var top = (screen.height / 2) – (h / 2);
    var targetWin = window.open(url, “_popup”, “width=” + w + “, height=” + h + “, top=” + top + “, left=” + left);
    }

    $(“.tw-share”).click(function() {
    popup(“//gadsbysociao.tumblr.com/make#textnet-twshare”, “400”, “250”);
    });

    $(“.fb-share”).click(function() {
    popup(“//gadsbysociao.tumblr.com/make#textnet-fbshare”, “400”, “250”);
    });
    `

    I need some help so bad.

    #161806
    chrisburton
    Participant

    Please add your code to CodePen.

    #161809
    Chris Lowles
    Participant

    Sorry, will do.

    Ok here it is: Link

    #161811
    chrisburton
    Participant

    What about your HTML?

    #161875
    Chris Lowles
    Participant

    K just fixed it.

    #161882
    TheDoc
    Member

    You’re not using the proper n-dash (-) for the subtraction. Looks like the m-dash (–) is causing the ILLEGAL token error.

    #161885
    chrisburton
    Participant

    There’s also a mix of straight and curly quotes.

    #161903
    Chris Lowles
    Participant

    i don’t seem to have the m-dash as a key on my keyboard

    #161965
    TheDoc
    Member

    Looks like it’s working now? It’s not working on Codepen because:

    Blocked opening 'http://gadsbysociao.tumblr.com/make#textnet-twshare' in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.
    
    #162007
    Chris Lowles
    Participant

    How do I set the allow-frames permission?

    #162721
    James
    Participant

    You can’t, as CodePen previews are displayed within an iframe and the sandbox mode for the preview simply won’t allow popups.

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.