I ‘ve noticed that my images( the links around them) that i load with ajax calls arent have the click event triggered on them, so the lightbox is not working on theses new elements,
I think this comes from a wrong syntax of .on() function;
line 47:
1 |
return $(this).on("click", onClick); |
this is the syntax for .live() function;
The jQuery documentation show that :
1 2 3 |
$(selector).live(events, data, handler); //jQuery 1.3+ $(document).delegate(selector, events, data, handler);//jQuery 1.4.3+ $(document).on(events, selector, data, handler); // jQuery 1.7+ |
you should bind this way:
$(document).on(“click”, this, onClick);
It worked for me with my own events…
状况:使用ajax加载的图片,不能使用lightbox的效果,解决方法是把wp-lightbox-2.js第47行的代码的on改成live,问题解决~
暂无评论