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

fancybox popup wrong initial size
fancybox2 dialog is hidden on touch devices
FancyBox attach more href
fancybox open iframe when clicking different element
Fancy box will not work
Deeper documentation for Fancybox2?
“Clicking” to advance image on a mobile device
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

Categories

HOME
multithreading
clips
single-sign-on
dictionary
homebrew
onedrive
spagobi
kalman-filter
elm
graphql
survey
ip
pivotal-cloud-foundry
networkx
dacpac
reveal.js
spring-xd
mapserver
orchardcms
decomposition
progressive-web-apps
propel
solaris-10
sylius
icloud-api
dxf
sqlcipher
sparse-matrix
spark-jobserver
selectedindexchanged
nhapi
tooltipster
fluentvalidation
libuv
flink-streaming
semantic-versioning
http-get
textmate
wallpaper
catalog
file-format
disassembling
hue
tasker
keydown
slick-3.0
user-accounts
osx-mavericks
dropbox-php
togetherjs
colorama
np-complete
python-cryptography
fputcsv
nsviewcontroller
skype4py
superstack
python-stackless
hexdump
unity-networking
maven-tomcat-plugin
lemon
mutation-observers
tmuxinator
pundit
computer-algebra-systems
method-parameters
appfabric-cache
web-controls
asp.net-dynamic-data
javafx-webengine
xcode-6.2
onactivityresult
heisenbug
bundles
oracle-warehouse-builder
c18
oam
dotnetnuke-5
back-stack
django-nonrel
removeclass
eclipse-templates
genshi
invite
paster
xsdobjectgen
filtered-index
fixed-width
multi-tier
grid-system
ajax-forms

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App