Welcome Guest, Not a member yet? Register   Sign In
Javascript and Jquery Library usage and documentation
#1

[eluser]matula[/eluser]
I'm trying to figure out how to use the javascript library, and either the documentation isn't clear... or I'm just not understanding.

I can load the javascript library, and access it's methods fine:
Code:
$this->load->library('javascript');
// output the script tag with external js
echo $this->javascript->external();
But I'm not getting the "$library_src" and "$script_head" part. Plus the documentation also says you can load the Jquery class using "$this->load->library('jquery');"... which is wrong.

After some playing around, I get things like this work:
Code:
$js = $this->javascript->click('#button', $this->javascript->animate('#box', array('width'=>'200%'), 'normal'));
// use inline, and put it at end of page...
echo $this->javascript->inline($js);
Looking at the classes themselves, it seems like the "compile" method is doing most of the work... but I can't quite figure out how to use it.

Any ideas on how this library is supposed to work?

-Terry
#2

[eluser]Vanitas[/eluser]
I'm trying to understand it to. I think that by using
Code:
$this->load->library('javascript');
you're in fackt loading JQuery library so you can use
Code:
$this->jquery->event('element_path', code_to_run());
and so on...

More unclear matter is event handling:
Code:
$this->jquery->click('selector_one', $this->jquery->toggleClass('selector_again?', 'some_class'));
Why I have to give selector again in toggleClass() function if the only object that I want to modify is the clicked one?

I hope some tutorials will appear in the Internet soon.
#3

[eluser]nedimtx[/eluser]
This video tutorial might be useful for you..

http://net.tutsplus.com/videos/screencas...ay-8-ajax/
#4

[eluser]Vanitas[/eluser]
I already saw it ;p
This is an example of using JQuery 'beside' CodeIgniter. I don't like it - it makes mess in views code.

I'm waiting for day when JQuery library for CI will be as powerfull as 'normal' JQuery (because I don't see any way to write as flexible code as it is in 'normal' JQuery).
#5

[eluser]Sayian[/eluser]
I am also lost about how to use this.

I have tried for hours to get it to work and cannot.




Theme © iAndrew 2016 - Forum software by © MyBB