How add Callback
-
Hello, I need to add a callback function…
I try to add in file easy-fancybox-class.php inside fb_opts but doesn’t work.
-
I need to remove/add a class after close fancybox
Hi infohowdy,
I try to add in file easy-fancybox-class.php inside fb_opts but doesn’t work.
That would be the best way, yes. What code did you try?
Hello RavanH, after close I need to add/remove class or show something like this:
afterClose: function(){$('body').append('<div id="thanks" style="position:absolute;z-index:99999;background:red;color:black;top:10px;left:10px;padding:5px;">Thanks for watching !</div>');}
I try to add the code before closing fb_opts (around line 80)in easy-fancybox-class.php
echo ', \'afterClose\': function(){$(\'body\').append(\'<div id="thanks" style="position:absolute;z-index:99999;background:red;color:black;top:10px;left:10px;padding:5px;">Thanks for watching !</div>\');}'; echo ' }; var easy_fancybox_handler = function(){';
Sorry, easy-fancybox-class.php is not the correct file. You need to edit easy-fancybox-settings.php instead. It holds a large array with all the default options. Find (for example) the Youtube array which starts with:
'YouTube' => array( 'title' => __('YouTube','easy-fancybox'), 'input' => 'multiple', 'options' => array( 'intro' => array ( ...
Now add an extra array key right between that
'options' => array
and the following'intro' => array
like:'onClosed' => array ( 'noquotes' => true, 'default' => 'function() { $("body").append("<div id=\"thanks\" style=\"position:absolute;z-index:99999;background:red;color:black;top:10px;left:10px;padding:5px;\">Thanks for watching !</div>"); }' ),
(do not forget that comma at the end there)
Notes:
1. Please be aware that after the next plugin update, your modification will be gone!
2. You’ll have to do this for every media type if you want same (or similar) messages for all.Hello, thankyou!
I tried to add options around line 370 in easy-fancybox-class.php but seems doesn’t work
This is the code I wrong somethings ?'IMG' => array( 'title' => __('Images','easy-fancybox'), 'input' => 'multiple', 'options' => array( 'intro' => array ( 'hide' => true, 'description' => __('To make images open in an overlay, add their extension to the Autodetect field or use the class "fancybox" for its link. Clear field to switch off all autodetection.','easy-fancybox') . '<br />' ), /*my option*/ 'onClosed' => array ( 'noquotes' => true, 'default' => 'function() { $("body").append("<div id=\"thanks\" style=\"position:absolute;z-index:99999;background:red;color:black;top:10px;left:10px;padding:5px;\">Thanks for watching !</div>"); }' ), /*end my option*/
Do you get any errors? Can you share a link to your site?
Sure ! I thankyou very much !
This is the link http://urlgone.com/2d7e05/I’m sorry for short url but is a test page (will expire on 2016)
this is the code from line 369 to 386
'IMG' => array( 'title' => __('Images','easy-fancybox'), 'input' => 'multiple', 'options' => array( 'intro' => array ( 'hide' => true, 'description' => __('To make images open in an overlay, add their extension to the Autodetect field or use the class "fancybox" for its link. Clear field to switch off all autodetection.','easy-fancybox') . '<br />' ), /*my option*/ 'onClosed' => array ( 'noquotes' => true, 'default' => 'function() { $("body").append("<div id=\"thanks\" style=\"position:absolute;z-index:99999;background:red;color:black;top:10px;left:10px;padding:5px;\">Thanks for watching !</div>"); }' ), /*end my option*/ 'tag' => array ( 'hide' => true, 'default' => 'a.fancybox, area.fancybox, li.fancybox a:not(li.nofancybox a)' ),
Replace the
$("body")
withjQuery("body")
and it should start working 🙂Thankyou very much!
- The topic ‘How add Callback’ is closed to new replies.