Title: Live() Function
Last modified: August 21, 2016

---

# Live() Function

 *  Resolved [xs650](https://wordpress.org/support/users/xs650/)
 * (@xs650)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/live-function/)
 * I am using FancyBox with a Switcher Panel and am having the issue described here
   
   [http://code.google.com/p/jquery-content-panel-switcher/wiki/Using_Other_Plugins_With_JCPS](http://code.google.com/p/jquery-content-panel-switcher/wiki/Using_Other_Plugins_With_JCPS)
 * The info explains how to use Live() if using the code, but I am at a lose on 
   how to deploy this on my WP site using the FancyBox WP plugin and switcher panel.
 * My FancyBox works great except when its on an element that is hidden on load 
   and the exposed with the Switcher Panel.
 * [http://wordpress.org/plugins/easy-fancybox/](http://wordpress.org/plugins/easy-fancybox/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/live-function/#post-4279436)
 * Hi, the live() function in jQuery has been depricated for a while now and has
   been removed in the latest versions (1.10 included with WordPress these days 
   does not have it anymore) so that is not an option anymore… The function on()
   replaces it.
 * Try this code in a text widget or in your themes footer.php file:
 *     ```
       <script type="text/javascript">
       jQuery(document).on('click', easy_fancybox_handler );
       </script>
       ```
   
 * But be aware this is an ‘expensive’ work-around since it fires up the fancybox
   init code on each click…
 *  Thread Starter [xs650](https://wordpress.org/support/users/xs650/)
 * (@xs650)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/live-function/#post-4279444)
 * I am OK with ‘expensive’
    I only need it on one switcher panel on the site
 * I have been trying to get this work with no luck.
 * I found this example of it working, not with the plugin but with the Jquery Library
   
   [http://www.picssel.com/playground/jquery/jQueryONreplacingContent_07mar12.html](http://www.picssel.com/playground/jquery/jQueryONreplacingContent_07mar12.html)
 *  [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/live-function/#post-4279445)
 * > I am OK with ‘expensive’
   >  I only need it on one switcher panel on the site
 * The thing is that this code will take toll on EVERY click on your site, not only
   the ones in that one switcher panel…
 * > I found this example of it working, not with the plugin but with the Jquery
   > Library
   >  [http://www.picssel.com/playground/jquery/jQueryONreplacingContent_07mar12.html](http://www.picssel.com/playground/jquery/jQueryONreplacingContent_07mar12.html)
 * The example suggests using “focusin” instead of “click”. This will probably not
   work in combination with `jQuery(document)`…
 * But if you know this switcher panel (wrapper) div’s ID or class, then you can
   make the snippet work with focusin and at the same time make it much less ‘expensive’
   by limiting the call to that ID or class. For example:
 *     ```
       <script type="text/javascript">
       jQuery('#switcherpanel').on('focusin', easy_fancybox_handler );
       </script>
       ```
   
 * If you can share a link to your page with this switcher panel, I can tell you
   more 🙂
 *  Thread Starter [xs650](https://wordpress.org/support/users/xs650/)
 * (@xs650)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/live-function/#post-4279457)
 * My page is here
    [http://northiowacorridor.com/business-climate/incentives/](http://northiowacorridor.com/business-climate/incentives/)
 * Two panels, Local & State from the Top Sub nav
 * Easy Fancy Box works great on the first panel that loads with the page
 * Thanks for helping me with this.
 *  [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/live-function/#post-4279465)
 * OK, remove the two (!) on-click code snippets and instead create a text widget
   in your sidebar (place it last) with no title and the code
 *     ```
       <script type="text/javascript">
       jQuery('#switcher-panel').on('focusin', easy_fancybox_handler );
       </script>
       ```
   
 * as content.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Live() Function’ is closed to new replies.

 * ![](https://ps.w.org/easy-fancybox/assets/icon-256x256.png?rev=3188201)
 * [Firelight Lightbox](https://wordpress.org/plugins/easy-fancybox/)
 * [Support Threads](https://wordpress.org/support/plugin/easy-fancybox/)
 * [Active Topics](https://wordpress.org/support/plugin/easy-fancybox/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/easy-fancybox/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/easy-fancybox/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/live-function/#post-4279465)
 * Status: resolved