Skip to content

Instantly share code, notes, and snippets.

@mfrancois
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save mfrancois/9003066 to your computer and use it in GitHub Desktop.

Select an option

Save mfrancois/9003066 to your computer and use it in GitHub Desktop.
Bootstrap Plugin jQuery
(function($)
{
$.distExemple = function(element, options)
{
this.settings = $.extend(true, {}, $.distExemple.defaults, options);
this.element = element;
this.init();
}
$.extend($.distExemple,
{
defaults:
{
},
prototype:
{
init: function()
{
this.initData();
this.initEvent();
},
initData: function()
{
},
initEvent: function()
{
}
}
});
$.fn.distExemple = function(options)
{
return this.each(function()
{
if (undefined == $(this).data('distExemple'))
{
$(this).data('distExemple', new $.distExemple(this, options));
}
});
}
})(jQuery);
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<body>
<div id="test"></div>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('#test').distExemple({
'params1':true
});
});
</script>
<script type="text/javascript" src="js/distExemple.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment