Note that there are some explanatory texts on larger screens.

plurals
  1. POIntegrating jquery Roundabout with Facebox
    primarykey
    data
    text
    <p>I am trying to create a "featured items" section on my portfolio using a <a href="http://fredhq.com/projects/roundabout" rel="nofollow noreferrer">Roundabout</a>. I have also attached <a href="http://defunkt.io/facebox/" rel="nofollow noreferrer">Facebox</a>, so that when a user clicks on one of the Roundabout items, it's hidden div pops up in the modal window. That's all working well and fine.</p> <p>My problem is that all of the items are clickable, not just the in focus item, and in trying to spin the carousel, Facebox is activated (there is a very small area that can be clicked to make things spin, but no visitor to the website will have the patience to find it). I need to find a way to disable the links on out-of-focus items, so that only the front item is clickable, thus making it possible to spin the carousel. </p> <p>Here's my script:</p> <pre><code>&lt;script&gt; $(document).ready(function() { $('ul#myRoundabout').roundabout(); $('a[rel*=facebox]').facebox(); }); &lt;/script&gt; </code></pre> <p>Here's the HTML:</p> <pre><code> &lt;ul id="myRoundabout"&gt; &lt;li&gt;&lt;a href="#bp" rel="facebox"&gt;&lt;img src="images/ft/bp_ft.jpg" alt="Open house site" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#me" rel="facebox"&gt;&lt;img src="images/ft/me_ft.jpg" alt="Personal website" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#wct" rel="facebox"&gt;&lt;img src="images/ft/wct_ft.jpg" alt="Travel agency site" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#zen" rel="facebox"&gt;&lt;img src="images/ft/zen_ft.jpg" alt="CSS Zen Garden" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;!-- hidden divs to call--&gt; &lt;div id="bp" style="display:none;"&gt; &lt;h3 class="box"&gt;Websites &amp;gt; BP Community Open House&lt;/h2&gt; &lt;img class="box" src="images/gallery/bp_lg.png" /&gt; &lt;/div&gt; &lt;div id="me" style="display:none;"&gt; &lt;h3 class="box"&gt;Websites &amp;gt; kitkatkookoo designs&lt;/h2&gt; &lt;img class="box" src="images/gallery/me_lg.png" /&gt; &lt;/div&gt; &lt;div id="wct" style="display:none;"&gt; &lt;h3 class="box"&gt;Websites &amp;gt; World Culture Tours&lt;/h2&gt; &lt;img class="box" src="images/gallery/wct_lg.png" /&gt; &lt;/div&gt; &lt;div id="zen" style="display:none;"&gt; &lt;h3 class="box"&gt;Websites &amp;gt; CSS Zen Garden&lt;/h2&gt; &lt;img class="box" src="images/gallery/zen_lg.png" /&gt; &lt;/div&gt; &lt;!-- end hidden divs--&gt; </code></pre> <p>I found a related question <a href="https://stackoverflow.com/q/6057686/1096833">here</a>. The working solution was a line added to the script:</p> <pre><code>$('ul.image-gallery .roundabout-in-focus a').live('click',function(event){event.preventDefault();$.fancybox({'href':$(this).attr('href')});}) </code></pre> <p>I realize that it is for Fancybox, not Facebox, but a girl can hope. I tried to edit it to suit my needs:</p> <pre><code>$('ul#myRoundabout .roundabout-in-focus a').live('click',function(event){event.preventDefault();$.facebox({'href':$(this).attr('href')});}) </code></pre> <p>But given my limited knowledge of js, I failed. Throwing that into the mix only served to shut down Facebox altogether. I'm thinking it has to do with the fact that I'm using div's instead of images, but I don't know how to adapt the code.</p> <p>Any help would be appreciated.</p> <p><hr /> EDIT:</p> <p>After reading <a href="https://stackoverflow.com/q/3450709/1096833">this post</a> I tried to disable all the links in my roundabout, so that I could work backwards to reactivate the in-focus item. Another no-go however; everything was still clickable.</p> <p>This is the code I tried adding in my script tags:</p> <pre><code>$('ul#myRoundabout roundabout-in-focus a').unbind('click.facebox'); </code></pre> <p>Still not sure what's going wrong here. </p> <p><hr /> Edit 2:</p> <p>Trying to get creative here. I deleted the <code>rel=facebox</code> from my links, and added the following to my <code>&lt;script&gt;</code> tag:</p> <pre><code>$('ul#myRoundabout li').focus(function(){ $('ul#myRoundabout .roundabout-in-focus a').attr('rel','facebox'); }); </code></pre> <p>My hope with this was that the links wouldn't have the facebox rel until they were in-focus, so facebox wouldn't launch when they were out of focus. Once again, no such luck. This method shut down facebox so that it didn't launch at all. I feel like I'm dancing in circles around the answer here...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload