- This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
Viewing 11 posts - 1 through 11 (of 11 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Error with Popup function
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.
Please add your code to CodePen.
Sorry, will do.
Ok here it is: Link
What about your HTML?
K just fixed it.
You’re not using the proper n-dash (-) for the subtraction. Looks like the m-dash (–) is causing the ILLEGAL token error.
There’s also a mix of straight and curly quotes.
i don’t seem to have the m-dash as a key on my keyboard
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.
How do I set the allow-frames permission?
You can’t, as CodePen previews are displayed within an iframe and the sandbox mode for the preview simply won’t allow popups.