0

I am having some problems when trying to use jQuery from within colorbox.

When I call any jQuery from the page that calls the colorbox it works fine.

My code currently calls a colorbox with another page inside it using the following code.

var page1 = '/page1/page.php';

jQuery(".page1click").colorbox({opacity:0.4, rel:'nofollow', href:page1, height:'700px', width: '702px', iframe:true});

This all works correctly and my code is showing within the colorbox popup. Also all of my javascript code is working within this page. However when I try and use any jQuery from within the colorbox it does not work.

What i am trying to do is hide a div when it is clicked.

If anyone could help that would be great

2 Answers 2

3

Check whether u included jquery in both the pages. This can create conflicts.

Sign up to request clarification or add additional context in comments.

1 Comment

I have included jQuery in both pages now and the jQuery that i am calling from within a javascript function is working fine but when i try to use $(document).ready(function(){}); it is giving me the error "$ is not defined".
0

With plugins that create overlays, like colorbox, they take your html markup and create another element in the DOM with it. Therefore the div you are trying to hide, might not have the same ID/class that you used to create it.

Please inspect the element using firebug in firefox to see what ID/class your div has been assigned by the plugin when you are viewing the box created by Colorbox.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.