jQuery undefined error using trigger to popup box

158 views
Skip to first unread message

cohq82

unread,
Nov 16, 2009, 2:15:42 AM11/16/09
to fancybox
When I do $('a.#div1').trigger('click') to popup a fancybox, it gives
me this error (using Firebug)

opts.itemArray[opts.itemCurrent] is undefined if (opts.itemArray
[opts.itemCurren...[opts.itemCurrent].title.length > 0) {\r\n
jquery.f...-1.2.1.js (line 345)

Why is that? Can you help?

Thanks.

steven

unread,
Nov 17, 2009, 9:27:34 PM11/17/09
to fancybox
I pretty much have the same problem but the object expected error only
occurs when i click the link 2nd time.
here is the code,

<script language="javascript" type="text/javascript">
function SetToCookie(clientid, catid, lessonid) {
setCookie("clientid", clientid, 1);
setCookie("catid", catid, 1);
setCookie("lessonid", lessonid, 1);
//alert($("a#autostart").fancybox());
$("a#autostart").fancybox().trigger('click');
}
</script>

<div class="Nav"><a href="#" onclick="SetToCookie('172','22','312')"
>TEST from script</a></div>
<div class="Nav"><a href="test.htm" id="autostart" >Hidden or not</a></
div>

when i click TEST from script the first time, the content in test.htm
will be shown in fancybox, but when i close the fancy box and click
TEST from script again,
an object expected error will occur. $("a#autostart").fancybox() is
where the error come from. Any help will be appreciated.

berlin1525

unread,
Nov 21, 2009, 3:21:44 PM11/21/09
to fancybox
Any update on this? I'm having the same issue and cannot find a
resolution. I'm not even using the itemArray object.

This is the error I'm receiving:
opts.itemArray[opts.itemCurrent] is undefined
http://...../js/jquery.fancybox-1.2.1.js
Line 336

Mike Shaffer

unread,
Dec 11, 2009, 8:23:10 AM12/11/09
to fancybox
I am getting the exact same thing. Has this ever been resolved?



On Nov 21, 2:21 pm, berlin1525 <berlin1...@gmail.com> wrote:
> Any update on this?  I'm having the same issue and cannot find a
> resolution.  I'm not even using the itemArray object.
>
> This is the error I'm receiving:
> opts.itemArray[opts.itemCurrent] is undefinedhttp://...../js/jquery.fancybox-1.2.1.js

Frederic Hemberger

unread,
Dec 17, 2009, 8:33:31 AM12/17/09
to fancybox
In line 104, replace

while ( opts.itemArray[ opts.itemCurrent ].href != elem.href ) {
opts.itemCurrent++;
}

with

var elemPosition = jQuery.inArray(elem.href, opts.itemArray);
if (elemPosition > -1) { opts.itemCurrent = elemPosition; }

Reply all
Reply to author
Forward
0 new messages