Help with colorbox

edited July 2012 in News & Announcements
Hello,

I know this is probably not a fuel problem but maybe you can help?

I have a sidemenu that calls pages with ajax.
The url is: mysite/members/submenuitem (This is actually a category name)

In the view that is being called I have a gallery that uses colorbox.
So the members.php file has this script in it:
jQuery('ul.gallery li a').colorbox();

The html in the members.php file:
<ul class="gallery"> <?php $CI->load->model('member_images_model'); $images = $CI->member_images_model->find_all(array('member_id'=>$memberId), 'id asc'); foreach($images as $img): $image = img_path() . 'members/' .$img->image; echo '<li> <a href="' . $image .'" rel="' . $memberId . '"><img src="' . $image . '" height="100" /></a> </li>'; endforeach; ?> </ul>

The colorbox js file and css files are being loaded, I checked in the page source.

Yet I am getting this error:

jQuery("ul.gallery li a").colorbox is not a function
[Break On This Error]

jQuery('ul.gallery li a').colorbox();

Any ideas why?

Comments

  • edited 2:06PM
    Did you wrap it in a load function like so:
    $(function(){
    jQuery("ul.gallery li a").colorbox()
    });
  • edited 2:06PM
    Ok, I removed the ajax call, and calling the sidemenu items like this:
    http://localhost/clarenssaNewFuel/page
    Now the colorbox is working.
Sign In or Register to comment.