Question on : syntax
|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Question on : syntaxI 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? |
||||||||
|
|
Re: Question on : syntaxOne thing to keep in mind, is that when you are using : to specify a filter, it will always be inside of a string. "input:button" for example.
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? |
||||||||
|
|
Re: Question on : syntaxlets 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 <dschinkel@...> wrote:
|
||||||||
|
|
Re: Question on : syntaxThanks 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...@...> 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...@...> 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? |
||||||||
|
|
Re: Question on : syntaxwhat 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...@...> 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...@...> 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...@...> 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? |
||||||||
|
|
Re: Question on : syntaxi will use simple terms
when i say namespace lets call our namespace bmw this should be a little simpler. someone decides to create bmw as namespace or brand name now one of the functions or perks of this is that you can paint it a certain color. you could say it's like create your own brand name and adding functions and perks to it that will attract people to use your brand. var bmw = function() { return { paint: function(color, o); var obj = document.getElementById(o); o.style.color = color; } }; }(); On Thu, Jul 2, 2009 at 8:10 PM, expresso <dschinkel@...> wrote:
|
||||||||
|
|
Re: Question on : syntaxit is similar do dotnet yes
JS ========== var mynamespace = function() { return { hide : function(o) { var obj = document.getElementById(o); o.style.display = 'none' } } }(); dot net C# ========== namespace mynamespace { void hideElemen(string elementName)t { elementName.visibility = false; } } On Thu, Jul 2, 2009 at 8:15 PM, expresso <dschinkel@...> wrote:
|
||||||||
|
|
Re: Question on : syntaxcorrection to my dotnet cod
namespace mynamespace { public class myclass{ void hideElemen(string elementName)t { elementName.visibility = false; } } } }
On Thu, Jul 2, 2009 at 8:21 PM, waseem sabjee <waseemsabjee@...> wrote: it is similar do dotnet yes |
| Free embeddable forum powered by Nabble | Forum Help |