Skip to content

Instantly share code, notes, and snippets.

View devdays's full-sized avatar

Bruce D Kyle devdays

View GitHub Profile
@devdays
devdays / CallingTheTrigger.html
Created February 24, 2015 00:18
Calling a Trigger
<script>
var theClicker = $("#myClicker").clicker({
isUpdated: function (event, data) {
console.log("isOneHundredOne");
alert("Is " + data.myValue);
}
});
theClicker.clicker({ newValue: 101 });
</script>
@devdays
devdays / callingWidgetWithSetOptions
Created February 23, 2015 23:10
Setting options
myClicker.clicker( { currentValue: 100 } );
newCurrentValue = myClicker.clicker("currentValue");
alert(newCurrentValue);
@devdays
devdays / addMethod.js
Created February 23, 2015 21:16
Calling the Add Method
(function ($) {
$.widget("custom.clicker", {
// Default options.
options: {
startingValue: 0,
_currentValue : 0
},
// _create and other methods to access properties ommitted ..
@devdays
devdays / callingGettersAndSetters.html
Created February 23, 2015 21:10
Getting the startingValue, getting or setting the currentValue in a jQuery UI Widget
<script>
// initializing the startingValue
var myClicker = $("#myClicker").clicker({ startingValue: 4 });
// getting the startingValue
alert(myClicker.clicker("startingValue"));
// setting the currentValue
myClicker.clicker("currentValue", 7);
// getting the currentValue
@devdays
devdays / jquerywidget-clicker-0.0.1.js
Created February 23, 2015 19:35
jQuery widget create with default options values
(function ($) {
$.widget("custom.clicker", {
// Default options.
options: {
startingValue: 0
},
_create: function () {
var startingValue = this.options.startingValue;
@devdays
devdays / jquerywidget-clicker-0.0.1.js
Created February 23, 2015 19:32
jQuery Widget _create
(function ($) {
$.widget("custom.clicker", {
_create: function () {
var startingValue = this.options.startingValue;
this.element.text("The starting value is " + startingValue);
}
});
}(jQuery));
@devdays
devdays / passingOptionValues.js
Created February 23, 2015 19:29
Passing option values to the widget
$("#myClicker").clicker( {
startingValue: 4
});
@devdays
devdays / clickewidget.html
Last active August 29, 2015 14:15
Page to host clicker widget
<!DOCTYPE html>
<html>
<head>
<title>Clicker</title>
</head>
<body>
<div id="myClicker">
</div>
<script src="Scripts/jquery-2.1.3.js"></script>
<!DOCTYPE html>
<html>
<head>
<title>Footnoter</title>
</head>
<body>
<p id="myParagraph">
In up so discovery my middleton eagerness dejection explained. Estimating excellence ye contrasted
insensible as. Oh up unsatiable <span class="footnote">Unpacked reserved sir.</span> interested.
Present suppose in esteems indemesne colonel it to. End horrible she landlord screened stanhill.
@devdays
devdays / setting-options.js
Created February 23, 2015 00:19
Setting and using options
$.fn.footnote = function (options) {
// This is the easiest way to have default options.
var settings = $.extend({
// These are the defaults.
color: "blue",
referencesLocation: "#references"
}, options);
// use the options