ReferenceError: launchWindow is not defined
This is a modified version of a script I found on the web earlier on. It works great up until I try and invoke the use of another HTML file (content.html), at which point it errors as in the title.
It also gives the same error if you move the "'content.html ' + " from line 9 to line 34.
No such error occurs if you just try and load an element in the same HTML file.
No such error occurs when using .load() with essentially the same code.
What gives? Help appreicated!
---
- $(document).ready(function() {
- //on click of an a tag with .downloadLink as class
- $('.downloadLink').click(function(e) {
-
- //stop the link from following through
- e.preventDefault();
-
- //Get the a href tag and suffix that to content.html[space]
- var id = 'content.html ' + $(this).attr('name');
-
- //Get the screen height and width
- var maskWidth = $(window).width();
- var maskHeight = $(document).height();
-
- //Set height and width to mask to fill up the whole screen
- $('#downloadMask').css({'width':maskWidth,'height':maskHeight});
-
- //transition effect
- $('#downloadMask').fadeIn(1000);
- $('#downloadMask').fadeTo("slow",0.7);
-
- //Get the window width and height
- var winW = $(window).width();
- var winH = $(window).height();
-
- //Set the popup window to center
- $(id).css('top', winH/2-$(id).height()/2);
- $(id).css('left', winW/2-$(id).width()/2);
-
- //transition effect
- $(id).fadeIn(2000);
-
- //id is the ID for the DIV you want to display it as modal window
- launchWindow(id);
-
- });
-
- //if close button is clicked
- $('.downloadDialogExit').click(function (e) {
- //Cancel the link behavior
- e.preventDefault();
- $('#downloadMask, .downloadDialog').fadeOut(400);
- $('#downloadMask, .downloadDialog').fadeTo("fast");
- });
-
- //if mask is clicked
- $('#downloadMask').click(function () {
- //hide the mask and dialog
- $('#downloadMask, .downloadDialog').fadeOut(200);
- $('#downloadMask, .downloadDialog').fadeTo("fast");
- });
-
- $(window).resize(function () {
-
- var box = $('.downloadDialog');
-
- //Get the screen width and height
- var maskWidth = $(window).width();
- var maskHeight = $(document).height();
-
- //Set height and width to mask to fill up the whole screen
- $('#downloadMask').css({'width':maskWidth,'height':maskHeight});
-
- //Get the window width and height
- var winW = $(window).width();
- var winH = $(window).height();
-
- //Set the popup window to center
- box.css('top', winH/2 - box.height()/2);
- box.css('left', winW/2 - box.width()/2);
-
- });
- });