I wonder why link doing nothing if I click on it and select close automatically just right after it was opened.
Here is my jsFiddle
To call fancybox window automatically, I use this code: $('#task').fancybox().trigger('click');
How to fix it?
You are getting confuse about the use of fancybox.
First, you need to set the class="fancybox"
to the anchor <a>
, not to the <div>
parent container of both, the anchor and the target ( select
).
Second, the target should be a different element, not the root (this href="/"
doesn't make sense in your case), which contains the launcher and the target.
Third, it would be a good idea to set the proper html structure to the select
element, which is inside of a form
tag.
See this forked fiddle for a working sample.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.