1

All of the documentation assumes the content content load into colorbox will happen as a result of click... (e.g., the parameters calling colorbox are built into the link)

My Example

I want to issue a redirect to a URL that then opens in colobox...

Any suggestions or experience solving this?

1

You should use java-script and the iframe support in color-box.

<script type="text/javascript">
  $(document).ready(function() {
    $("a", ".the-class-added-to-links-clicking-which-will-open-theurl-in-coloyxbox").click(
      function(event) {
        event.preventDefault();
        var elementURL = $(this).attr("href");
        $.colorbox({iframe: true, href: elementURL, innerWidth: 645, innerHeight: 509});
      });
  });
</script>

Code Source : https://stackoverflow.com/a/8933655/493742

1

If you have installed colorbox module that you don't need to add any library files just use the below code to open lightbox in you custom code

<a href="http://hdwallsource.com/img/2014/7/desktop-images-15066-15533-hd-wallpapers.jpg" class="customclass"> Open colorbox </a>

  <script>
    jQuery(document).ready(function() {
        jQuery("a.customclass").click(
          function(ev) {
            ev.preventDefault(); //To prevent redirection
            var hr = jQuery(this).attr("href");
            jQuery.colorbox({iframe: true, href: hr , innerWidth: 500, innerHeight: 400});
          });
      });
 </script>

Here href will be link of the page that you want to open in colorbox.

Hope it will help you.

0

When you load the new URL, you'll need to have javascript on the page to fire the colorbox load event.

4
  • On the page that is being loaded??? It is a URL that calls a function that then loads a page...
    – sea26.2
    Sep 4 '13 at 23:55
  • First you need to do the redirect, then you need to open the colorbox. It will require javascript. Sep 4 '13 at 23:58
  • Thank you... It looks like the answer is probably no, you can't, unless you can control the content that you are redirecting to. If the content were a foreign URL, then no. I'm I understanding your answer correctly?
    – sea26.2
    Sep 5 '13 at 0:11
  • I was assuming that you controlled the page you were redirecting to...if you don't then the answer is definitely no. Sep 5 '13 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.