Welcome Guest, Not a member yet? Register   Sign In
[Solved]problem with jquery plugin
#1

[eluser]amipaxs[/eluser]
Hello ,

I'm trying to use a lightbox-style plug-in in my contact page, the problem is that on firebug console i get the following message

Code:
$("a#single").fancybox is not a function

code on contact.php

Code:
<div class="img-wrapper">
  
  <a href="&lt;?php echo base_url();?&gt;img/selsin_mapa.jpg" id="single">
  <img src="&lt;?php echo base_url();?&gt;img/selsin_mapa.jpg" width="200" height="300" alt=""/></a>
  
</div>

I have seen this "is not a function" message with diferents plugins when not used on the index page, even when I browse the source code in contact i see the paths to jquery and plugin are ok , so i copied the code from above in the index page and it works perfectly, it opens the image using the fancybox plugin.
the jquery code that triggers the fancybox is located on the head section in the template
as seen below:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Suma&lt;/title&gt;
&lt;link href="&lt;?php echo base_url();?&gt;css/estilo.css" type="text/css" rel="stylesheet"   /&gt;
&lt;link href="&lt;?php echo base_url();?&gt;css/jquery.fancybox.css" type="text/css" media="screen" rel="stylesheet"  /&gt;

<xxxx type="text/javascript" src="&lt;?php echo base_url();?&gt;js/jquery-1.4.3.min.js" ></xxxx>
<xxxx type="text/javascript" src="&lt;?php echo base_url();?&gt;js/jquery.fancybox.pack.js" ></xxxx>

[removed]
$(document).ready(function(){
     $("a#single").fancybox();
});
  
[removed]
&lt;/head&gt;

why do i get the error below when not in index ??
Code:
$("a#single").fancybox is not a function
  $("a#single").fancybox();

thanks in advance!




Theme © iAndrew 2016 - Forum software by © MyBB