# jQuery's fancyZoom and delayedObserver conflict

**URL:** <https://www.ruby-forum.com/t/jquerys-fancyzoom-and-delayedobserver-conflict/159470>\
**Category:** Rails\
**Created:** [February 4, 2009, 8:53pm UTC](https://www.ruby-forum.com/t/jquerys-fancyzoom-and-delayedobserver-conflict/159470 "2009-02-04T20:53:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [February 4, 2009, 8:53pm UTC](https://www.ruby-forum.com/t/jquerys-fancyzoom-and-delayedobserver-conflict/159470/1 "2009-02-04T20:53:55Z")

</div>

Hello list,

I know this is more client-side stuff since I’m using Rails js helpers,  
I  
thought I would be posting here. [http://pastie.org/379754](http://pastie.org/379754) – the  
delayedObserver simply doesn’t work when fancyZoom is activated (it  
simply  
fails silently). If I remove the fancyZoom related code, it works ok.  
Here’s  
a sample code: [http://pastie.org/379754](http://pastie.org/379754). Does anyone know why?

Thanks,

Marcelo.

---

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [February 13, 2009, 1:38am UTC](https://www.ruby-forum.com/t/jquerys-fancyzoom-and-delayedobserver-conflict/159470/2 "2009-02-13T01:38:51Z")

</div>

Ok, here’s why:

fancyZoom hides the target div, and its show() method then creates a  
duplicate of this DOM subtree. The problem is that it keeps the same  
ids,  
and we all know we can’t have elements with the same ID – thus, $() and  
getElementById fail. The solution was to be more specific and select  
like  
this: $(’#zoom-content #id’), where #zoom-content is the name of the  
duplicated div that fancyZoom creates, which is different from the  
hidden  
div.

Marcelo.

On Wed, Feb 4, 2009 at 1:53 PM, Marcelo de Moraes S.  
\<removed\_email\_address@domain.invalid
