ChristieMADE.com
  • Home
  • Portfolio
  • Blog
  • Contact
  • Menu Menu

Archive for category: jquery

Inline content slideshow with Colorbox

by Christie
September 17, 2011

So, here’s the situation.  I have a bunch of images, and each image has a larger version and some rich text content to go with it, that needs to be opened in a modal window.  All the related content for each image sits within the page, so I need to use inline content.  I am also using Colorbox for the modal window.  I had a hellofva time finding an appropriate tutorial and example for this online.  A lot of people are trying to do similar things, but there’s either no solution or what they want isn’t close enough to what I’m trying to accomplish.  Every photo needs to have its own link AND still be in a prev/next slider once the modal opens.

After a lot of trial and error, I figured out how to do it.  So here goes:

THE HTML

For your links themselves:

  <a href="#preview1" class="preview">Preview 1</a>
  <a href="#preview2" class="preview">Preview 2</a>
  <a href="#preview2" class="preview">Preview 3</a>

For the inline content boxes:

<div style="display:none">
    <div id="preview1" rel="previewBox">
          <div>Awesome HTML Content</div>
    </div>
    <div id="preview2" rel="previewBox">
          <div>Awesome HTML Content</div>
    </div>
    <div id="preview2" rel="previewBox">
          <div>Awesome HTML Content</div>
    </div>
</div>

THE JAVASCRIPT

<script type="text/javascript">

  $(document).ready(function() {

    $(".preview").colorbox({
      open:false,
      inline:true,
      html: function() {
          var div = $(this).attr('href'); return $(div).html();
      },
      href: $(this).attr('href'),
      rel: 'previewBox'
    });

  });

</script>

Anyway, here’s hoping this saves someone some time! This was done successfully with Colorbox 1.3.17.2 and jQuery 1.4.1.

0 Comments
how-tos, jquery, problems & solutions
colorbox, jQuery, slideshow

Categories

  • great links
  • how-tos
  • problems & solutions
    • back-end
    • drupal
    • jquery
    • wordpress
  • recommendations

Tags

ajax animation apache audio captcha colorbox CSS css3 domain management drupal Elementor Enfold godaddy google hosting Hosting Configuration hosting management HTML iis JavaScript jQuery Languages Launch maintenance Mato Microsoft Word Network Solutions Pantheon Parallax php php.ini podcast recaptcha recaptcha v3 responsive scss server slideshow submenu SVG transfer Translation vimeo wordpress WPML
Search Search

Recent Comments

  • Mike Armani on Avoid GoDaddy’s Dedicated Server
  • Nathan on Image Alignment Doesn’t Work in TinyMCE

Archives

  • September 2019
  • April 2017
  • September 2011
  • May 2010
  • February 2010
  • May 2009
  • April 2009
  • February 2009
  • January 2009
  • September 2008
  • August 2008
  • July 2008
© 1999-2026 ChristieMADE.com
  • Link to X
Scroll to top Scroll to top Scroll to top