Tiny js based helper for creating buttons
Step 1: Insert the ButtonBuddy.js into the head of your html document
<script src="ButtonBuddy.js"></script>
Step 2: Generate your first button. Just include a script part before the closing body tag and initalize your button.
<script>
var myButton = new ButtonBuddy('My Testbutton');
myButton.on('click', function() {
alert('Hello there');
})
</script>
With the on method you can quickly add events to the button.
NOTE: If you use the type click ButtonBuddy automaticly adds a event.preventDefault()
<script>
var myButton = new ButtonBuddy('My Testbutton');
myButton.on('click', function() {
alert('Hello there');
})
myButton.on('mouseover', function() {
alert('Hello there');
})
</script>
By default ButtonBuddy loads automaticlly the base css file in the head. If you don`t like this feature just disable it:
ButtonBuddy.useCssLoader(false);
Define the path to the css file wich should be automaticcly loaded. Note that the path begins with the origin domain.
@dependency: useCssLoader = true
ButtonBuddy.setGlobalCssPath('path/to/my/cssFile/style.css');