fancybox-2


Fancybox 2 not showing when calling .open()


I'm trying to rig up a Knockout binding for Fancybox (although I don't think that's too much involved here). I'm calling Fancybox based on the code from the sample here: http://jsfiddle.net/STgGM/
$.fancybox.open([{
href: value.image(),
title: value.title()
}], {
padding: 0
});
The object passed in looks like:
{href: "http://example.com/imageurl", title: "Image Title"}
Stepping through the fancybox code, it bails out of trying to show the image around line 855 of the script:
if (!type) {
F.coming = null;
//If we can not determine content type then drop silently or display next/prev item if looping through gallery
if (F.current && F.router && F.router !== 'jumpto') {
F.current.index = index;
return F[ F.router ]( F.direction );
}
return false;
}
I'm not entirely sure what it's looking for at this point. F.current is null and F.router doesn't exist on the object.
So, in short, I'm trying to trigger Fancybox from a link click, without modifying my markup that much, or calling .fancybox() on a particular element. This appears to be possible, but it doesn't appear to be working for me.
After digging through the code more, I eventually found the solution. Fancybox was trying to figure out what sort of content I was telling it to display by inspecting the URL I was giving it. As my URL had no extension, since it was coming from an external service that uses and ID to access an image, and not a full file name, Fancybox had no clue what I was telling it to display, and gave up.
The solution, since I know what the content is, is this:
$.fancybox.open({
href: value.image(),
title: value.title(),
type: 'image'
},//other stuff (not relevant to this)
This makes FancyBox work as expected.

Related Links

Open image in Fancybox 2 in fullscreen not sized [SOLVED]
Fancybox 2 multiple titles
Fancybox 2.1.5 doesn't show close button on mobile
Images will not pop up in FancyBox.
Fancybox2 api open() ignores options?
fancyBox 2 Vimeo embedding not working
Jquery Fancybox-media prev and next buttons need three clicks to work
Fancybox quicktimes loading properly locally but not on server
Skip 404 links with fancybox2
Fancybox data-fancybox-type=“iframe” and Strict XHTML Doctype
Fancybox 2 Title “Inside” on YouTube (iframe)?
fancy box prev and next buttons // how to show in some and not others
Fancybox 2 not showing when calling .open()
Audio continues after fancyBox closes
fancybox 2 & IE8 - no background overlay
fancybox in ie9 displaying left bottom

Categories

HOME
log4j
vbscript
mfc
path-finding
xmpp
google-docs
sqlite3
in-app-purchase
dax
hapi
footer
wkwebview
fish
underflow
traffic
rst2pdf
windows-server-2000
objectanimator
stormpath
javascriptcore
galsim
android-kernel
overriding
jmonkeyengine
withings
objectlistview
squib
unoconv
isbn
.net-4.6.2
fault
dotcover
revapi
prolog-setof
sage-one
rdfs
colorama
setter
forever
kbuild
ifs
pearson
epson
cudafy.net
specrun
pycaffe
heidisql
phishing
transmitfile
jwplayer7
ubuntu-10.04
ready-api
phpcas
prerequisites
map-projections
interrupted-exception
createprocessasuser
formatjs
codeigniter-url
relocation
fpml
bitcoinj
elliptic-curve
rebol3
comexception
xceed-datagrid
jboss-weld
didselectrowatindexpath
ms-project-server-2010
opcache
gridcontrol
seed
online-compilation
wse3.0
transactionscope
eclipse-templates
inotifycollectionchanged
fluent-interface
dmx512
text-coloring
w3wp
msdev

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App