what is meant by a namespace. I view namespace as like in .NET classes, is this the same concept?
On Jul 2, 1:10 pm, expresso <dschin...@gmail.com> wrote: > Thanks a lot. The second response really helped me as I'm not so > versed in hard core JavaScript. Obviously not being that well versed > in it is hindering my ability to understand plug-in code, ability to > distinguish between standard JavaScript notation/features vs. jQuery > in the same file, and ability to understand jQuery a bit also. > > migrane every day until I get this stuff down, not as simply as > everyone says. Yea jQuery is simple once you are a master at > JavaScript and master of the jQuery language! I love that claim. > > On Jul 2, 1:00 pm, waseem sabjee <waseemsab...@gmail.com> wrote: > > > 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 <dschin...@gmail.com> 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?