I think fancybox breaks things

Permalink
I have the jquery script fancybox working on a site, however if I insert

$(document).ready(function() {

$("a.thumb").fancybox({
centerOnScroll: 'true'
});

});

then editable blocks in the edit mode are not usable (no highlighting, no drop-down menu).

This sucks. :(

 
russellfeeed replied on at Permalink Reply
russellfeeed
Hi tomeone

I haven't got a true fix for this yet, just a workaround, but I'm seeing the same issue I think.

I'm using the Fancy Image Links block (http://www.concrete5.org/marketplace/addons/fancy-image-links/), which uses the fancybox JS.

I've added the FIL block to my header by creating two global Scrapbook blocks and adding
<?php
               $block = Block::getByName('your_account_button');
               if( $block && $block->bID ) $block->display();
            ?>
         <?php
               $block = Block::getByName('activate_button');
               if( $block && $block->bID ) $block->display();
            ?>

to my header.php in my theme.



Some pages are fine. On others the Edit button button on the top toolbar doesn't work.

Looking in Firebug/Chrome Debugger I'm getting an error on the console saying the objects don't have a method called fancybox().

Sure enough, when you look at which JS libraries are loaded, jquery.fancybox-1.3.4.pack.js isn't.

Looking in Fancy Image Link's controller.php I see
public function on_page_view() {
         if ($this->enable_lightbox) {
            $html = Loader::helper('html');            
            $bv = new BlockView();
            $bv->setBlockObject($this->getBlockObject());
            $this->addHeaderItem($html->css($bv->getBlockURL() . '/fancybox/jquery.fancybox-1.3.4.css'));
            $this->addHeaderItem($html->javascript($bv->getBlockURL() . '/fancybox/jquery.fancybox-1.3.4.pack.js'));
         }
      }


So I removed the condition by commenting out
if ($this->enable_lightbox) {

and the corresponding closing }

Voila, my edit button works again!

Cheers
Russell
russellfeeed replied on at Permalink Reply
russellfeeed
Hmmmm....

further investigation tells me that actually, Fancy Image Link's controller/on_page_view() is not getting called for some pages

Now I'm stuck.
russellfeeed replied on at Permalink Reply
russellfeeed
russellfeeed replied on at Permalink Reply
russellfeeed
I've added the following to my theme
packages/<mytheme>/themes/<mytheme>/inc/top.php

<link rel="stylesheet" href="<?php echo DIR_REL; ?>/packages/fancy_image_links/blocks/fancy_image_links/fancybox/jquery.fancybox-1.3.4.css" type="text/css"  />
<script type="text/javascript" src="<?php echo DIR_REL; ?>/packages/fancy_image_links/blocks/fancy_image_links/fancybox/jquery.fancybox-1.3.4.pack.js"></script>


and now all pages can be editted