Welcome Guest, Not a member yet? Register   Sign In
jQuery class
#1

[eluser]bralens[/eluser]
Have enybody try to use jquery class that come with codeigniter download?

when i try to load jquery class i get this: Unable to load the requested class: jquery

when i load javascript class it looks like all is fine but there are errors.

can someone tell me alternative to this library or what i'm doing wrong?
#2

[eluser]Basketcasesoftware[/eluser]
I've been kind of curious about this one myself. I've been using JQuery in my current project a lot, and it would be wonderful to have an aid in using it.

Edit: Has anyone looked at that driver entry in the manual? It's a mess.
#3

[eluser]Aken[/eluser]
I don't agree with a Javascript class, for a few reasons:

1) Separation. Javascript should be in separate files and loaded appropriately. The class forces script output into the HTML (and even recommends putting it in the <head> of the document, which is not good).

2) Performance. Elaborating on #1, script directly in the HTML cannot be cached. At most it can be gzipped with the HTML.

3) Learning curve. If you want to get involved with Javascript, start learning basic JS. Then start learning the library of your choice. I don't understand the need for a PHP library with its own unique functions and methods to output a JS library with its own unique functions and methods.

Javascript is an extension of the View part of MVC, in my opinion. It should be kept out of the rest.
#4

[eluser]Basketcasesoftware[/eluser]
@Aken - I agree. That's the pattern I've been following as a matter of fact. I DO prefer to put my Java file loads in the header. I don't agree with the pattern of embedded js at the end of the document. I consider js definitions to be a form of declaration, like CSS, and as such belongs at the start.
#5

[eluser]Aken[/eluser]
The problem with loading Javascript in the head is that the rest of your page will not load until that JS file has loaded. So if there is a hang up for whatever reason, it'll just sit there doing nothing until it loads or times out. If you load JS at the bottom of your body, all the content can and will load.

Javascript (most of the time) should be considered an extra feature. Your website should be functional without it. A lot of people have JS disabled, or blocked by adblocking programs or something similar. As such, you shouldn't rely on it unless your website or application specifically require it for whatever reason.

http://stackoverflow.com/questions/19670...-html-file
http://developer.yahoo.com/performance/rules.html
#6

[eluser]Basketcasesoftware[/eluser]
Yep, we are stuck with the lovely loading patterns of our web browsers. I recently had a bug though that was the result of the js loading at the bottom oddly enough. Moved it to the top and bye-bye buggy. Smile
#7

[eluser]osci[/eluser]
@Basketcasesoftware

I had encountered an opposite bug.

Note: I almost always put all my js in bottom (except analytics, in slow servers due to the
delay it has in loading I missed clicks - users were faster Smile )

To the bug. I was writing in a hurry html to do some checks and had my js on top. I had to calculate the height of 3 divs to do something to another. In IE and chrome IF I recall I was getting wrong values and of course the design was breaking. I tested and tested to understand why I wasn't getting correct values. It was in a jquery onload so I expected when it would fire.
I took my js to bottom and the values were correct and design stood nice.

So It's not always the case to put js on top, plus it is not recommended for speed (google favors speed nowadays).
#8

[eluser]Aken[/eluser]
[quote author="Basketcasesoftware" date="1308636666"]Yep, we are stuck with the lovely loading patterns of our web browsers. I recently had a bug though that was the result of the js loading at the bottom oddly enough. Moved it to the top and bye-bye buggy. Smile[/quote]
Curious what kind of bug that could've been. Perhaps you were just expecting it to do something before it was fully loaded? Similar to what osci just said about his analytics missing user actions because they clicked right away.
#9

[eluser]Basketcasesoftware[/eluser]
Nope. Nothing of the sort. A JQuery library load. It's been a while and I don't remember the library itself, but it certainly had me scratching my head. The main document had to have scripting calls in it. Not surprisingly, the library had to be loaded first. Thank you Firebug for helping me find that one. The main Jquery library is small enough that I can begrudge it the load time.
#10

[eluser]Aken[/eluser]
Sounds like a poorly written library, then. They should never have requirements on where the script is placed. Only the order on which they're loaded (you can't load a jQuery plugin script before the jQuery library, for example).




Theme © iAndrew 2016 - Forum software by © MyBB