Could anybody give me an explanation of the underscore in a jQuery plugin function? I have no idea of what “_” means. Example code below:
$.fn.bgStretch=function(o){
this.each(function(){
var th=$(this),
data=th.data('bgStretch'),
_={
align:'leftTop',
altCSS:{},
css:{
leftTop:{
left:0,
right:'auto',
top:0,
bottom:'auto'
},
rightTop:{
left:'auto',
right:0,
top:0,
bottom:'auto'
},
leftBottom:{
left:0,
right:'auto',
top:'auto',
bottom:0
},
rightBottom:{
left:'auto',
right:0,
top:'auto',
bottom:0
}
},
preFu:function(){
_.img
.load(function(){
_.checkWidthFu()
_.img
Just as lanzz commented. This is a variable.
Look at how the varaiables are declared:
Another way to it is:
It might as well have been called
_someVar.