Jump to content
Killersites Forums

Goodbye Javascript, hello...


Recommended Posts

jQuery. :D

 

You know, I've never really understood all that gobble-de-gook that is javascript, even though I once wrote a tutorial. I mean, I was able to manipulate it, but only up to a point. It's hard trying to manipulate something when it's too blinking complicated, and you only need to use it very occasionally.

 

Not only do I feel comfortable now reading through 'Learning jQuery', code and all, as if it were an easy read, but it almost looks as familiar as does css.

 

I've only been reading the very early chapters, and already I'm excited about 'Chaining'. I've forgotten some of the other stuff, but I can still see most of that code dancing in front of my eyes. :lol:

 

It's early days yet, I know, but if I stick with it, it might help me to spring-board on, so to speak, on other language platforms. :D

 

I'm not 100% sure, but I believe Pakt, the publishers, allow for pdf downloads, so just in case you're in too much of a hurry now to be getting your hands of an actual book, you have, at least, options. :cool:

 

Incidentally, there's a video tutorial of more than a few episodes, which I haven't been able to watch yet. But just in case you can't wait to see what it's all about, then you can catch all video lessons from Theme Forrest's blog...

 

http://blog.themeforest.net/page/3/?s=jQuery

 

 

Normally, I wouldn't stick with just one resource, but I really like this books approach, and may simply stick with it, until my mind really starts to get frazzled. :lol:

Link to post
Share on other sites

Yeah, that's not a bad resource there, jlhaslip :cool:

 

I must admit, that even though I'd much prefer to watch this stuff, you do benefit more from reading how to do this stuff properly from the very people who understand it.

 

I was watching the first few video lessons, and while it was fascinating to see how easy it all looked, things about how the code is made up was being left out.

 

The authors of 'Learning jQuery' really go out of there way to give you a good understanding of how that code is made up, and how best to use it. The same can't be said for those video tutorials, though they are immensely tantalizing. :D

 

Btw, I just like to apologize for creating a new thread, as I had not seen Eric's original thread.

 

Getting back to jQuery doing what it does... What I really like is this 'Dom traversal' thingy, the use of custom selectors, XPath selectors, chaining, and even making your jQuery look almost like css.

 

This jQuery reminds me a lot of how I first started to think about css, and how easy (I thought then) it is to manipulate.

 

Direct from memory (though, I must get back to the actual reading of it)...

 

$ (document) .ready(function() {

$ ('a[@href^=mailto:]') .addClass('mailto');

$ ('a[@href*=.pdf]') addClass(pdflink);

$ ('a[@href$=mysite.com]') .addClass('mysite');

});

 

...Live checking... Yep, I'd say that the code was spot on. Shows me that the old memory banks aren't quite so run down. :D

 

That little snippet of code represents how you can manipulate XPath Selectors. It looks complicated, I know, and there are one or two things I'm not 100% sure about, but they're trivial in comparison to what's missing on those video tutorials.

 

I'm not going to explain all of this, so here's a snippet of a snippet. XPath selectors allows you to target any part of an url's, or a link's path...

 

^ beginning of an url

* end of an url

$ anywhere in the middle

 

I think what's fascinating about jQuery, is that you can have all of this diversity in your mark-up, code and whatever, and have everything look neat and tidy. Larry Ullman does mention, in his blog, about 'Unobtrusive Javascript'. But really, with this jQuery everything becomes unobtrusive, funnily because even though you can now create even more styles, those same styles won't be clogging up your mark-up. :D :cool:

Link to post
Share on other sites
  • 2 weeks later...

I took a little break in learning jQuery, and now regret it -- big time. Silly me. :rolleyes:

 

Erm, anyway, I've been trying to recapture that first explosion of excitement, and in doing so I've noticed something rather odd, and maybe even trivial that I didn't notice the first time around when looking at how jQuery interacts with CSS...

 

Normally, when we create styles for our mark-up, we first define them either internally or externally, and then create the extra mark-up needed to accommodate those styles in the form of attributes and values.

 

jQuery is a bit weird as to how it is able to link and change any of those styles that you have already created for your mark-up.

 

Not only can you create a method within your jQuery scripts in which to add another class to the ones you already have in your styles and mark-up, but you can seemingly not create any extra styles, at all, and only incorporate them into your mark-up. Eh..?

 

I'm only a beginner with this jQuery framework, thingy, but already it's blown a few fuses in my mind. Unfortunately, when I get excited reading stuff like this, I don't do what most of you will do... Carry on reading the book? No, my mind goes off tangent, and races away into some other weird and colorful dimension.

 

...But what about that rather odd (beginner's) discovery? You know, the one about only creating the mark-up for your styles and not the actual styles that you would normally first define?

 

I haven't really been able to wrap my head around that one yet, but it seems to me that just by defining it in a jQuery script instead of a style sheet is as good as defining it in your styles -- maybe?

 

I've got to some how control this excitement of mine, otherwise my mind will turn into a firework's display, or more than likely a bomb going off in my brain. :lol:

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...