best way to handle several body onload |
[eluser]zenon[/eluser]
Hi, I'm using jquery routine to init all elements where body document is laoded. Code: $(document).ready(function(){ How could I handle this routine for each page? One solution may be to build a first common header part and another specified on each controller, but another solution I heard could be to inject a javascript source still from controller. Have you ever hear about this? However, which approach do you use? Thank you ![]()
[eluser]R_Nelson[/eluser]
can you give an example of what your trying to do your question seems a bit vague to me
[eluser]Namaless[/eluser]
Code: jQuery(document).ready(function() { This is only simple example to use with Code: $this->load->view( 'jquery_script' );
[eluser]joakley77[/eluser]
Not sure exactly what you're trying to do but why not use one .js file and do whatever you need to do if the element is visible? Code: $(document).ready(function() {
[eluser]bubbafoley[/eluser]
you can have multiple document ready functions http://www.learningjquery.com/2006/09/mu...ment-ready
[eluser]zenon[/eluser]
[quote author="Namaless" date="1299719143"] Code: This is only simple example to use with [CODE]$this->load->view( 'jquery_script' ); What stands for jquery_script? Is it a .js ? If so, I would keep the script tag inside head element, as w3c suggests. A possible solution would be Code: $this->load->view( 'header_first_part' ); // open <head> element
[eluser]zenon[/eluser]
[quote author="bubbafoley" date="1299724923"]you can have multiple document ready functions http://www.learningjquery.com/2006/09/mu...ment-ready[/quote] I can't figure out how use it. Can you make a more accurate example please? thank you! ![]() |
Welcome Guest, Not a member yet? Register Sign In |