Welcome Guest, Not a member yet? Register   Sign In
Jquery not working! help
#1

[eluser]RodrigoFM[/eluser]
Hi

I've switch to codeigniter i found it to be very productive, but i still have some issues. i can't make the jquery to work on views or external .js files. Only pure javscript works. I am including it right (header fragment of the view):

[removed][removed]
[removed][removed]

or locally

[removed][removed]

Modify my .htaccess file in the base directory:

RewriteEngine on
RewriteCond $1 !^(index\.php|css|images|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

even wrote the js part like this: |jquery\.js|

try loading the libraries in autoload.php:

$autoload['libraries'] = array('database', 'javascript', 'jquery');

but nothing..

you can view the site here: www.noctta.com
for example the effect of the "Noticias" section uses jquery mouseweel and other, arrows down and up doesesn't work a simple alert("hello"); doesn't work either.

(footer fragment view jquery code)

[removed]

$(document).ready(function(){

alert("hola");

//gallery
$("#gallery1").jCarouselLite({ btnNext: ".next", btnPrev: ".prev", mouseWheel: true, vertical: true, circular: true, visible: 3, speed: 600, easing: 'easeOutCirc'}); Cufon.now();})

[removed]

I am using WHM+Cpanel.

Please help!

#2

[eluser]RodrigoFM[/eluser]
code removed because i didn't use "code" tag.

Code:
[removed][removed]
  [removed][removed]


or locally

Code:
[removed][removed]

Thanks
#3

[eluser]Ed Robindon[/eluser]
Firebug says "TypeError: $(document).ready is not a function" when I load your page.

Looking at the scripts in your <head> tag seems they are all loaded properly.

Instead of putting the ready function in the foot of the page why not put it in the <head> tag>? May not make any difference but...
#4

[eluser]RodrigoFM[/eluser]
it didn't work what you suggested, jquery doesn't work even in the .js files. I put the alert() message out of the jquery function $(document).ready(function().. and it displays the message on the site: www.noctta.com

It's like jquery is just not loaded, i don't know what is it. The worst is that it used to work.
#5

[eluser]Ed Robindon[/eluser]
I put this in the head of the welcome_message.php view of a clean install of ci 2.1.2:
Code:
<s.cript src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></s.cript>
  <s.cript>
    $(document).ready(function(){alert("hello")})
  </s.cript>
("s.cript" keeps script from being removed...)

It works as expected.

I accidentally omitted the end script tag on the jq script line and it didn't work. Is this a possibillity?
#6

[eluser]RodrigoFM[/eluser]
Ok, i found something weird if i load:

<.script type="text/javascript" src="&lt;?= base_url();?&gt;js/scriptaculous.js"></.script>
<.script type="text/javascript" src="&lt;?= base_url();?&gt;js/prototype.js"></.script>

after

<.script type="text/javascript" src="&lt;?= base_url();?&gt;js/jquery-1.8.2.js"></.script>
<.script type="text/javascript" src="&lt;?= base_url();?&gt;js/jquery-1.8.2.min.js"></.script>

it doesn't work. It only works like this!

<.script type="text/javascript" src="&lt;?= base_url();?&gt;js/scriptaculous.js"></.script>
<.script type="text/javascript" src="&lt;?= base_url();?&gt;js/prototype.js"></.script>
<.script type="text/javascript" src="&lt;?= base_url();?&gt;js/jquery-1.8.2.js"></.script>
<.script type="text/javascript" src="&lt;?= base_url();?&gt;js/jquery-1.8.2.min.js"></.script>

I think that is funky, now is working www.noctta.com the efects from the Noticias section. And is working the external js with jquery. :/
#7

[eluser]RodrigoFM[/eluser]
It seems this was a common problem.

http://docs.jquery.com/Using_jQuery_with..._Libraries

Calling the method suggested should solve the problem. I have no idea since iv'e never used prototype before, only jquery.

Anyway I share this stuff! Thanks
#8

[eluser]Ed Robindon[/eluser]
Glad to help even if I didn't solve it for you...

That is funky but understandable in light of the "$" usage.

Like the jq page says, there are several ways to work aruond it.





Theme © iAndrew 2016 - Forum software by © MyBB