dou7851 2013-03-22 03:34
浏览 62
已采纳

base_url()。'assets / works给出css / images / js位置但是js没有在codeigniter中运行[关闭]

I have this structure

/www
    /code_igniter
        /application
        /assets
            +img
            +css
            +js
        /controllers
        /system

I load two views in controller:

class Control extends CI_Controller {
    function __construct()
    {
        parent::__construct();
        $this->load->database();
        $this->load->helper('url');  

    }
     public function index()
    {
         $this->load->view('header');
     $this->load->view('body');
    }

}

In header view I do:

<link type="text/css" rel="stylesheet" href='<?echo base_url().'assets/'?>css/stile.css' />
<link type="text/css" rel="stylesheet" href='<?echo base_url().'assets/'?>css/chosen.css' />

<script src="<?echo base_url().'assets/'?>js/jquery.min.js" type="text/javascript"></script>
<script src="<?echo base_url().'assets/'?>js/mousewheel.js" type="text/javascript"></script>
<script src="<?echo base_url().'assets/'?>js/easing.js" type="text/javascript"></script>
<script src="<?echo base_url().'assets/'?>js/logic.js" type="text/javascript"></script>

body has pure html.

when I see source code of generated view It can find the js, css and images but for some strange reason it is not executing the js as if it would not find them...

I tested locally and it works!!

To try to reproduce error I renamed js folfer and yeah, it shows the same result as when testing on server, i then rename it to js and works locally but not in server...

Do you know what could be causing this? Is driving me crazy

Could it be a crach between jquery.min.js ? It is like is not running anything,

I also find this issue I am loading http://rhinoslider.com/ in a script in header view

 $(document).ready(function() {
           alert("a");
       $('#slider').rhinoslider({
        controlsPlayPause: false,
                showControls: 'always',
                showBullets: 'always',
                controlsMousewheel: false,                   
        slidePrevDirection: 'toRight',
        slideNextDirection: 'toLeft'
            });


           alert("b");          
        $(".rhino-prev").hide();                
        $('.rhino-next').after('<a class="form-submit" href="#" >Next</a>');
                $(".rhino-next").hide();
      alert("c");       


        });

And I am only receiving alert a message, it is not executing or loading rhino slider why could it be ?

  • 写回答

1条回答 默认 最新

  • duankui6150 2013-03-22 04:49
    关注

    try this :

       <link type="text/css" rel="stylesheet" href='<?php echo base_url().'assets/'?>css/stile.css' />
      <link type="text/css" rel="stylesheet" href='<?php echo base_url().'assets/'?>css/chosen.css' />
    
      <script src="<?php echo base_url().'assets/'?>js/jquery.min.js" type="text/javascript"></script>
      <script src="<?php echo base_url().'assets/'?>js/mousewheel.js" type="text/javascript"></script>
      <script src="<?php echo base_url().'assets/'?>js/easing.js" type="text/javascript"></script>
      <script src="<?php echo base_url().'assets/'?>js/logic.js" type="text/javascript">
    

    or set

     short_open_tag = On
    

    in php.ini file in order to make short tag working on you localhost

    hope it will help!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示
  • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
  • ¥15 怀疑手机被监控,请问怎么解决和防止
  • ¥15 Qt下使用tcp获取数据的详细操作