Callback function

Buy now  £29 Get support

The example below must be served from localhost or a webserver example.

Make a call to your own JavaScript function on click.

  1. <html>
  2.     <head>
  3.         <title>Magic Magnify: Callback function</title>
  4.        
  5.         <!-- link to magicmagnify/magicmagnify.js file -->
  6.         <script src="magicmagnify/magicmagnify.js" type="text/javascript"></script>
  7.        
  8.     </head>
  9.     <body>
  10.        
  11.        
  12.         <p class="note">The example below must be served from localhost or a webserver <a href="http://demo.magictoolbox.com/magicmagnify/example12.html">example</a>.</p>
  13.        
  14.         <p>Make a call to your own JavaScript function on click.</p>
  15.        
  16.         <!-- define Magic Magnify -->
  17.         <a href="images/shoe_large.jpg" class="MagicMagnify" rel="callback:userCallbackFunc;"><img src="images/shoe_small.jpg"/></a>
  18.  
  19.         <script type="text/javascript">
  20.             function userCallbackFunc(x,y) {
  21.                 alert('Mouse click: '+x+":"+y);
  22.             }
  23.         </script>
  24.  
  25.        
  26.     </body>
  27. </html>