Setup
location_link
rel
attribute is equal to a city state combo (i.e.,Omaha, NE
)location_link
items and binds a click
event to them using jQuery.The Problem:
Whenever I click on one of the "location links", I get the following error message:
The requested content cannot be loaded. Please try again later.
Code I've Already Written:
function setUpLocationLinks() {
locationLinks = $("a.location_link");
locationLinks.click(
function() {
var me = $(this);
console.log(me.attr("href"));
$.fancybox(
{
"showCloseButton" : true,
"hideOnContentClick" : true,
"titlePosition" : "inside",
"title" : me.attr("rel"),
"type" : "image"
}
)
return false;
}
);
}
Research I've Already Done:
Note: The Google Static Maps API no longer requires a Maps API key! (Google Maps API Premier customers should instead sign their URLs using a new cryptographic key which will be sent to you. See the Premier documentation for more information.)
src
attribute out of.Hopefully, you'll find this information helpful. Please let me know if you have any other questions.
Here's what I came up with. It uses an empty <img> tag, but it works. I'd love to see someone come up with a more graceful solution.
function setUpLocationLinks() {
var locationLinks = $("a.location_link");
var mapImage = $("#map_image");
var mapImageContainer = $("#map_image_container");
var mapFancybox = function() {
$.fancybox.hideActivity();
$.fancybox(
{
"showCloseButton" : true,
"hideOnContentClick" : true,
"titlePosition" : "inside",
"content" : mapImageContainer.html()
}
);
}
locationLinks.click(
function() {
var clickedLink = $(this);
$.fancybox.showActivity();
mapImage.attr("src", clickedLink.attr("href")).load(
function() {
mapFancybox();
}
);
if(mapImage.complete) {
mapImage.triggerHandler("load");
}
return false;
}
);
}