Reputation: 829
I am facing an issue with fancybox right now. I got a website, with links to articles, which are shown in fancybox when clicked.
Now when an article is accessed directly, this is detected and the user get redirected to the index page, with the articel id as parameter. I detect this on the index page and want to open the article in fancybox right away.
This is the code I use:
[...] //finding out if parameter is passed and storing it in id
$.fancybox.open([
{
href:'localhost/article.php?p='+id,
title: 'test title'
}],
{
padding :0
});
[...]
This code is taken from the fancybox doc. When running this, no lightbox is shown, but the strange thing is, as soon as I replace the href with localhost/article.jpg fancybox fires and shows a box (containing error, that the content content could not be fount etc).
Question is now: Do I need a different syntax / some special settings to open php or html pages from code?
Upvotes: 0
Views: 108
Reputation: 1720
[...] //finding out if parameter is passed and storing it in id
$.fancybox.open([
{
href:'localhost/article.php?p='+id,
title: 'test title'
}],
{
padding :0
});
[...]
Try separating your parameters.
I think that the problem might be the fact that fancybox can't figure out that it should use iframe. Try adding type option, it worked for me.
$.fancybox.open([{
href: 'localhost/article.php?p='+id,
title: 'test title'
}], {
type: 'iframe',
padding: 0
});
Upvotes: 1