Unable to open bootstrap modal window |
[eluser]Unknown[/eluser]
I'm new to CodeIgniter and bootstrap and i'm having some problems to open the modal javascript. Here whats happening, i have a controller x and if i load a page from the index function it all works fine, but if a load from another function my bootstrap modal windows are not opening Code: class X extends CI_Controller{ My html would be like Code: <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> Now if i use jquery to open it, only opens when my url is http://mysite/x and when i load from http://mysite/x/not_index it cant open Code: $('#myModal').modal('toggle') i was able to open it using javascript changing the attributes from the id MyModal but i lost the nice effects that bootstrap has. Does anyone knows hot to fix this? Thanks!
[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter forums! How are you including your scripts? Have you made sure that they really are accessible by the source? Are you using the absolute path, or relative path for your scripts? If you're using Firefox, the Firebug addon can be extremely helpful with debugging these kinds of problems.
[eluser]Unknown[/eluser]
[quote author="TheFuzzy0ne" date="1363969457"]Welcome to the CodeIgniter forums! How are you including your scripts? Have you made sure that they really are accessible by the source? Are you using the absolute path, or relative path for your scripts? If you're using Firefox, the Firebug addon can be extremely helpful with debugging these kinds of problems.[/quote] Thanks TheFuzzyOne i'v changed my includes from relative path to absolut path and is working now
[eluser]TheFuzzy0ne[/eluser]
In your views, when you include scripts or CSS in your views, do the following: Code: <link href="<?php echo base_url(); ?>path/to/file.css" type="text/css" rel="stylesheet" /> That way your paths will be absolute, and will work even if you change your domain name, or run the app in another environment. |
Welcome Guest, Not a member yet? Register Sign In |