|
JQuery scrolling within a Div |
There is a demo of this here: JQuery scrolling within a Div
|
Passing variables to js files inline |
Ever wanted to pass a variables to a javascript file within the code?
You can declare JavaScript variables globally, but in this case a non technical person was editing the sites code base, so getting them to construct
JavaScript variables was going to be an issue. How about passing them through within the script tag?
|
Google maps panning example |
I liked the look of it, but wanted to create it in JQuery as it required a lot of custom server side code, and several expensive server software installations. Also I'm migrating away from the flash / flex arena into a more purist JQuery / AJAX development mindset.
There is a full example of Google Maps panning here
|
Differences in calling a function in JQuery |
2
3function changeFields(){
4 var selected = $("#type option:selected").val();
5 $('.formElems').hide();
6 $("." +selected).show();
7 }
I noticed then that all the other JQuery based functions do not construct the function as a separate entity. The function is embedded within the actual event handler.
More like this:
2 {
3 var selected = $("#type option:selected").val();
4 $('.formElems').hide();
5 $("." +selected).show();
6 });
Both methods work equally as well (IE they do what they are supposed to) but I can't see any reason you would do one over the other. The only thing I can think of is that in the first example the function is reference able from elsewhere, whereas the second code example is not.
Anyone more knowledgeable than me got a view on this?