Reputation: 5940
I'm trying to make Fancybox 2 accessible, but I can not set focus on the opening link when Fancybox is closed.
I tried this function but it does not work:
beforeClose: function() {
$(".fancybox").eq(this.index).focus();
}
Upvotes: 0
Views: 1061
Reputation: 41143
You just said to yourself "... when Fancybox is closed " so use the afterClose
callback instead like :
afterClose: function() {
$(this.element).focus();
}
See DEMO (easier to perceive in Chrome)
$(this.element)
refers to $(this)
in fancybox ... the link from where you invoked fancybox.
Upvotes: 1