Wiki source code of User Macro: include-lightbox - Fancybox including
Last modified by Normann P. Nielsen on 2013/04/18 19:10
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | Confluence also uses Fancybox, **this can give issues, at this moment this is not working i v4.1** | ||
| 2 | |||
| 3 | |= Name| include-fancybox | ||
| 4 | |= Macro Body Processing| No macro body | ||
| 5 | |= Output format| HTML | ||
| 6 | |= Usage| {include-fancybox} | ||
| 7 | |||
| 8 | This should actualle be called "attach-fancybox" as is attaches the build in fancybox (bundled with Confluence in the Advanced Macros) to object with id "single_image" | ||
| 9 | |||
| 10 | I use it i conjunction with [[User Macro: me-image - Image lightbox with fancybox>>Main.atlassian.atlassian-confluence.mos-eisley-gallery.user-macro-me-image-image-lightbox-with-fancybox]] | ||
| 11 | |||
| 12 | Code | ||
| 13 | |||
| 14 | |||
| 15 | {{code}} | ||
| 16 | <script type="text/javascript"> | ||
| 17 | AJS.toInit(function () { | ||
| 18 | jQuery('a#single_image').fancybox({ | ||
| 19 | 'width' : '80%', | ||
| 20 | 'height' : '80%', | ||
| 21 | 'speedIn' : 600, | ||
| 22 | 'speedOut' : 200, | ||
| 23 | 'overlayShow' : false | ||
| 24 | }); | ||
| 25 | }); | ||
| 26 | </script> | ||
| 27 | |||
| 28 | {{/code}} | ||
| 29 | |||
| 30 | Alternate code that scales picture after UserAgent, see more [[here>>http://davidwalsh.name/detect-ipad]] | ||
| 31 | |||
| 32 | |||
| 33 | {{code}} | ||
| 34 | <script type="text/javascript"> | ||
| 35 | |||
| 36 | var isiPad = navigator.userAgent.match(/iPad/i) != null; | ||
| 37 | |||
| 38 | if (isiPad) | ||
| 39 | { | ||
| 40 | var vWidth='50%'; | ||
| 41 | var vHeight='50%'; | ||
| 42 | } | ||
| 43 | else | ||
| 44 | { | ||
| 45 | var vWidth='100%'; | ||
| 46 | var vHeight='100%'; | ||
| 47 | } | ||
| 48 | |||
| 49 | AJS.toInit(function () { | ||
| 50 | jQuery('a#single_image').fancybox({ | ||
| 51 | 'width' : vWidth, | ||
| 52 | 'height' : vHeight, | ||
| 53 | 'speedIn' : 600, | ||
| 54 | 'speedOut' : 200, | ||
| 55 | 'overlayShow' : false | ||
| 56 | }); | ||
| 57 | }); | ||
| 58 | </script> | ||
| 59 | |||
| 60 | {{/code}} |