Skip to content

Instantly share code, notes, and snippets.

@brianyang
Created March 9, 2012 17:23
Show Gist options
  • Save brianyang/2007632 to your computer and use it in GitHub Desktop.
Save brianyang/2007632 to your computer and use it in GitHub Desktop.
K5 = (function(){
var k5 = []
k5.hotspot = {
init: function(markerX,markerY,icon,fadeRate,content,width,src,tail,bg,fade,pos){
k5.hotspot.markerCoord(markerX, markerY, pos)
k5.hotspot.adjFade(fadeRate)
k5.hotspot.sendContent(content)
k5.hotspot.tipWidth(width)
k5.hotspot.markerSrc(src)
k5.hotspot.imgHandler(icon,bg,tail)
},
config:{
markup: '<div id=foo />'
},
imgHandler: function(icon,bg,tail){
console.log('icon = ' + icon)
console.log('bg = ' + bg)
console.log('tail = ' + tail)
},
tipWidth: function(tWidth){
console.log('tipWidth = ' + tWidth)
},
markerSrc: function(src){
console.log('markerSrc = ' + src)
},
markerCoord:function(x,y,pos){
console.log('x : ' + x)
console.log('y : ' + y)
console.log('position = ' + pos)
},
adjFade:function(fadeRate){
console.log('fade amt: ' + fadeRate)
},
sendContent:function(tipContent){
console.log('content: ' + tipContent)
},
move:function(x,y){
console.log('move hotspot to =' + x + ', ' + y)
},
destroy:function(){
// destroy method is obsolete since we use object literals to create instances
// use a delete statement for each instance created with the new constructor function
console.log('destroy object')
}
}
return k5
}())
K5.hotspot.init(5,5,'icon.png',5000,'foo bar','width','src','tail','bg','fade','pos')
K5.hotspot.move(10,10)
K5.hotspot.destroy()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment