lets go back to basic JavaScript.
take this example
var display = function() { // create namespace display
return {
hide : function(o) { // add function hide to namepsace
var obj = document.getElementById(o);
if(obj.style.display != 'none') {
obj.style.display = 'none'
}
},
show : function(o) { // add function show to namespace
var obj = document.getElementById(o);
if(obj.style.display = 'none') {
obj.style.display = 'block'
}
}
};
}();
function init() {
display.hide("mydiv");
setTimeout("display.show('mydiv'), 1000);
}
window.onload = init;
it is a more object orientated way of scripting
as you can see i created my own namespace called display
then i assigned two function to it
display.hide
and
display.show
so you can say your are creating your own namespae with it's own set of
functions.
the cool thing is if i create a namespace that controls sideshow behavior i
can reuse my display namespace for the hide show transitions.
On Thu, Jul 2, 2009 at 7:08 PM, expresso <[email protected]> wrote:
>
> I have yet another syntax question.
>
> I know that : can be used for specifying things like filters, but what
> does it do in this case:
>
> $jc.fn.extend({
>
> setup: function() {
> this.first = null;
> this.last = null;
> this.prevFirst = null;
> this.prevLast = null;
> this.animating = false;
> this.timer = null;
> this.tail = null;
> this.inTail = false;
>
> if (this.locked)
> return;
>
> this.list.css(this.lt, this.pos(this.options.offset) +
> 'px');
> ...rest of code here
> },
>
> so what is the syntax setup: an attribute?