0

I have problem with integrating jQuery plugins in CodeIgniter. I put plugin folder in my root folder.

I add this code into header

<script type="text/javascript" src="<?php echo base_url();?>plugin/jquery.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>plugin/html5gallery.js"></script>

and in my view file

 <div style="display:none;" class="html5gallery" data-skin="vertical" data-width="480" data-height="272">

       <!-- Add images to Gallery -->
       <a href="images/Tulip_large.jpg"><img src="images/Tulip_small.jpg" alt="Tulips"></a>
       <a href="images/Swan_large.jpg"><img src="images/Swan_small.jpg" alt="Swan on Lake"></a>

       <!-- Add videos to Gallery -->
       <a href="images/Big_Buck_Bunny.mp4"><img src="images/Big_Buck_Bunny.jpg" alt="Big Buck Bunny, Copyright Blender Foundation"></a>

       <!-- Add Youtube video to Gallery -->
       <a href="http://www.youtube.com/embed/YE7VzlLtp-4"><img src="http://img.youtube.com/vi/YE7VzlLtp-4/2.jpg" alt="Youtube Video"></a>

       <!-- Add Vimeo video to Gallery -->
       <a href="http://player.vimeo.com/video/1084537?title=0&amp;byline=0&amp;portrait=0"><img src="images/Big_Buck_Bunny.jpg" alt="Vimeo Video"></a>

    </div

but i got error undefined is not a function

Any idea what i am doing wrong? Is it some conflict because i put file into view???

Sparky
  • 98,165
  • 25
  • 199
  • 285
  • Make sure your scripts are included, probably the path is incorrect. – The Alpha Aug 10 '14 at 23:25
  • because i have other files in my plugin folder , and i am caling my plugin in from view, is it that some kind of conflict? – Patrik Dupeliz Aug 10 '14 at 23:47
  • That's not a CodeIgniter error... that's a JavaScript error. **And as requested in the [previous deleted version of your question](http://stackoverflow.com/questions/25219939/integrate-jquery-plugins-into-codeigniter?noredirect=1#comment39291953_25219939), show the RENDERED code as seen in the browser source.** – Sparky Aug 12 '14 at 16:53

1 Answers1

1

Somewhere in your code, you are using a function, which is not declared, yet. So either it's your own source or a jQuery plugin, which calls this function, not existing (uninitialized or improperly initialized), yet.

Turn the order of the script tags. What you posted includes html5gallery.js after jquery.js. jQuery must be loaded before HTML5Gallery, because HTML5Gallery depends on jQuery functions. Framework first, Plugins last.

<script type="text/javascript" src="<?php echo base_url();?>plugin/jquery.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>plugin/html5gallery.js"></script>

Are both scripts really found and loaded? See you browsers console (F12) in the network tab.

Jens A. Koch
  • 39,862
  • 13
  • 113
  • 141
  • sory my error i write code wrong, in my scripy order is corect still i get error undefined is not a function – Patrik Dupeliz Aug 10 '14 at 23:48
  • Set jQuery at the top of includes JS scripts. Check jQuery noConflict / compatibility mode: http://stackoverflow.com/a/7975203/1163786 – Jens A. Koch Aug 11 '14 at 16:09
  • try that i cant find solutin still – Patrik Dupeliz Aug 12 '14 at 13:56
  • @PatrikDupeliz, nobody can help you because nobody knows what you're doing wrong, and simply saying _"I tried and it doesn't work"_ is not helpful to anyone. You're not showing enough code or responding to simple requests. Again, go to your browser, look at the _source code as rendered_ in the browser, then put that rendered code into your OP for us to see. Then just _maybe_ we'll see the issue. – Sparky Aug 12 '14 at 18:41