当试图链接我所做的手风琴和一些jquery css到codeigniter的正常视图页面时,我通过正确的文件夹链接了它们,但它似乎不知道它在哪里,有人可以帮助吗?
jquery链接很长,因为它运行在几个文件夹中。
<link href="<?php echo base_url()."css/jquery-ui-1.10.4.custom/css/dark-hive/jquery-ui-1.10.4.custom.css";?> type="text/css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<link href="<?php echo base_url()."css/my_accordion.js";?>"</script>
手风琴
$(document).ready(function() {
console.log("ready to do some jquery");
// $( "p" ).hide(); hide paragraphs
//$( "h2").hide(); // h2 hide
$( "h1" ).click(function() {
console.log("you clicked a paragraph!");
$( "p" ).hide(500);
if (!$(this).hasClass("activeHeading")){
$(".activeHeading").next().slideUp(1000);
$(".activeHeading").removeClass("activeHeading");
$(this).next().fadeIn(1000);
$(this).addClass("activeHeading");
} //end of if
}); //end of click
}); //end of document
尝试在"css"之前添加一个额外的斜杠。见下文:
<link href="<?php echo base_url()."/css/jquery-ui-1.10.4.custom/css/dark-hive
/jquery-ui-1.10.4.custom.css";?> type="text/css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<link href="<?php echo base_url()."/css/my_accordion.js";?>"</script>
如果你的css目录在你的应用程序文件夹中,那么CodeIgniter的重写规则可能会阻止对文件的访问。
试着在你的.htaccess文件的根目录下添加下面这行代码。
RewriteCond $1 !^(application/css)
所以前几行应该是:
RewriteEngine on
RewriteCond $1 !^(index'.php|images|robots'.txt)
RewriteCond $1 !^(application/css)