$.colorbox({href:"login.php"}); //this Works (opens login.php)
$(this).click(function(){
$.colorbox({href:"login.php"}); //Doesn't work (opens parent page after 5 sec and breaks colorbox)
}
What could be the problem?
Well, assuming that you copied and pasted the code, you're missing a paren. You should also call e.preventDefault()
to prevent the link?/button? from doing what it's intended to do.
$(this).click(function(e){
//Doesn't work (opens parent page after 5 sec and breaks colorbox)
$.colorbox({href:"login.php"});
//Prevent default so the button?/link? doesn't do what it's intended to do
e.preventDefault();
});