Welcome Guest, Not a member yet? Register   Sign In
trouble with load event in javascript class
#1

[eluser]Giorgio Nordo[/eluser]
Hi everyone,
I am playing with the JavaScript class.
Although the documentation for such a class is far to be exaustive, I made some successful experiment but I found a problem with the following easy code:

Code:
$codice = $this->javascript->hide('#divlogin');
$this->javascript->load('#divlogin', $codice);  
$this->javascript->compile();

which should simply attach the hide function to the load event of the same div.
It seems correct to me but, it doesn't work at all.
Could someone help me in understanding why?
Thanks in advance,
Giorgio
#2

[eluser]Giorgio Nordo[/eluser]
Well, I have solved by associating the load event to a dummy image contained in the view.
It seems that jquery is not able to check the loading of a generic div.
So, this is the code in my controller:
Code:
$codice = $this->javascript->hide('#divlogin');
$this->javascript->load('#dummyimage', $codice);
$this->javascript->compile();
and the view contains the line
Code:
<img id="dummyimage" src="&lt;?php echo site_url(); ?&gt;application/views/images/dummy.png" />
where dummy.png is the old friendly one-pixel transparent image.
I hope this can help.
Giorgio




Theme © iAndrew 2016 - Forum software by © MyBB