프로그램/script

fancybox 옵션 및 함수 설명

mulderu 2012. 4. 18. 10:54

fancybox 옵션 및 함수 설명


KeyDefault valueDescription
padding10Space between FancyBox wrapper and content
margin20Space between viewport and FancyBox wrapper
opacityfalseWhen true, transparency of content is changed for elastic transitions
modalfalseWhen true, 'overlayShow' is set to 'true' and 'hideOnOverlayClick', 'hideOnContentClick', 'enableEscapeButton', 'showCloseButton' are set to 'false'
cyclicfalseWhen true, galleries will be cyclic, allowing you to keep pressing next/back.
scrolling'auto'Set the overflow CSS property to create or hide scrollbars. Can be set to 'auto', 'yes', or 'no'
width560Width for content types 'iframe' and 'swf'. Also set for inline content if 'autoDimensions' is set to 'false'
height340Height for content types 'iframe' and 'swf'. Also set for inline content if 'autoDimensions' is set to 'false'
autoScaletrueIf true, FancyBox is scaled to fit in viewport
autoDimensionstrueFor inline and ajax views, resizes the view to the element recieves. Make sure it has dimensions otherwise this will give unexpected results
centerOnScrollfalseWhen true, FancyBox is centered while scrolling page
ajax{ }Ajax options 
Note: 'error' and 'success' will be overwritten by FancyBox
swf{wmode: 'transparent'}Params to put on the swf object
hideOnOverlayClicktrueToggle if clicking the overlay should close FancyBox
hideOnContentClickfalseToggle if clicking the content should close FancyBox
overlayShowtrueToggle overlay
overlayOpacity0.3Opacity of the overlay (from 0 to 1; default - 0.3)
overlayColor'#666'Color of the overlay
titleShowtrueToggle title
titlePosition'outside'The position of title. Can be set to 'outside', 'inside' or 'over'
titleFormatnullCallback to customize title area. You can set any html - custom image counter or even custom navigation
transitionIn, transitionOut'fade'The transition type. Can be set to 'elastic', 'fade' or 'none'
speedIn, speedOut300Speed of the fade and elastic transitions, in milliseconds
changeSpeed300Speed of resizing when changing gallery items, in milliseconds
changeFade'fast'Speed of the content fading while changing gallery items
easingIn, easingOut'swing'Easing used for elastic animations
showCloseButtontrueToggle close button
showNavArrowstrueToggle navigation arrows
enableEscapeButtontrueToggle if pressing Esc button closes FancyBox
onStartnullWill be called right before attempting to load the content
onCancelnullWill be called after loading is canceled
onCompletenullWill be called once the content is displayed
onCleanupnullWill be called just before closing
onClosednullWill be called once FancyBox is closed

KeyDescription
typeForces content type. Can be set to 'image', 'ajax', 'iframe', 'swf' or 'inline'
hrefForces content source
titleForces title
contentForces content (can be any html data)
origSets object whos position and dimensions will be used by 'elastic' transition
indexCustom start index of manually created gallery (since 1.3.1)

FancyBox provides some function to work with it

MethodDescription
$.fancybox.showActivityShows loading animation
$.fancybox.hideActivityHides loading animation
$.fancybox.nextDisplays the next gallery item
$.fancybox.prevDisplays the previous gallery item
$.fancybox.posDisplays item by index from gallery
$.fancybox.cancelCancels loading content
$.fancybox.closeHides FancyBox 
Within an iframe use - parent.$.fancybox.close();
$.fancybox.resizeAuto-resizes FancyBox height to match height of content
$.fancybox.centerCenters FancyBox in viewport