|
Project Information
Featured
Downloads
|
OverviewSimpleBox.js is a simple script (jquery module) used to overlay content on the current page. It's easy to setup and works on all modern browsers. RequirementsSimpleBox require jQuery framework to work How to use
<script src="/js/jquery.js" type="text/javascript"></script> <script src="/js/SimpleBox.js" type="text/javascript"></script> SimpleBox.open('jQuery Selector',(optional) {settings});SettingsSimpleBox can be customized. Feel and look can be define by using (optional) settings property. Here is an explanation of each settings element.
SimpleBox.open('<div>Hello World</div>',{
directInput:true
}); SimpleBox.open('#myContent',{
showCaption:true,
captionText:'My Caption',
captionCss:{'font-size':12}
});
SimpleBox.open('#myContent',{
showCloseImage:true,
defaultCloseImageSrc:'/images/closeButton_off.gif',
hoverCloseImageSrc:'/images/closeButton_on.gif',
closeImageCss:{top:3,right:4,border:"1px solid #fff"}
});
SimpleBox.open('#myContent',{
onOpen:function(myParam){alert(myParam)},
onOpenParam:'Hello World'
});
SimpleBox.open('#myContent',{
onClose:function(myParam){alert(myParam)},
onCloseParam:'Hello World'
}); SimpleBox.open('#myContent',{
bodyWebKitRoundCorners:10
});Methods
SimpleBox.open('<div>Hello World</div>',{
directInput:true
});SimpleBox.close(); SimpleBox.close(function(){alert('Hello World')}); SimpleBox.close(function(user){
alert('Bye '+user.name+' '+user.surname)
},
{name:'Marcin','surname':'R'}
);Real Usage Example<script type="text/javascript">
$(document).ready(function(){
$(".helper").each(function(){
$('#'+$(this).attr('rel')).css({display:'none'});
});
$(".helper").click(function(){
SimpleBox.open('#'+$(this).attr('rel'),{
showCaption:true,
captionText:$(this).attr('title'),
captionCss:{'font-size':15},
showCloseImage:true,
defaultCloseImageSrc:'/images/closeButton_off.gif',
hoverCloseImageSrc:'/images/closeButton_on.gif'
});
});
});
</script>
|