我正在玩//line 1
CAShapeLayer *shapeLayerOne = [CAShapeLayer layer];
shapeLayerOne.path = [LineOne CGPath];
shapeLayerOne.strokeColor = [[UIColor blueColor] CGColor];
shapeLayerOne.lineWidth = 1.0;
shapeLayerOne.fillColor = [[UIColor clearColor] CGColor];
//line 2
CAShapeLayer *shapeLayerTwo = [CAShapeLayer layer];
shapeLayerTwo.path = [LineTwo CGPath];
shapeLayerTwo.strokeColor = [[UIColor blueColor] CGColor];
shapeLayerTwo.lineWidth = 1.0;
shapeLayerTwo.fillColor = [[UIColor clearColor] CGColor];
//line 3
CAShapeLayer *shapeLayerThree = [CAShapeLayer layer];
shapeLayerThree.path = [LineThree CGPath];
shapeLayerThree.strokeColor = [[UIColor blueColor] CGColor];
shapeLayerThree.lineWidth = 1.0;
shapeLayerThree.fillColor = [[UIColor clearColor] CGColor];
//line 4
CAShapeLayer *shapeLayerFour = [CAShapeLayer layer];
shapeLayerFour.path = [LineFour CGPath];
shapeLayerFour.strokeColor = [[UIColor blueColor] CGColor];
shapeLayerFour.lineWidth = 1.0;
shapeLayerFour.fillColor = [[UIColor clearColor] CGColor];
[self.view.layer addSublayer:shapeLayerOne];
[self.view.layer addSublayer:shapeLayerTwo];
[self.view.layer addSublayer:shapeLayerThree];
[self.view.layer addSublayer:shapeLayerFour];
,但似乎无法让我的外部Bootstrap
工作。
我在js script
文件的末尾加载了以下脚本:
HTML
首先加载 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/myscript.js"></script>
,然后调用我的脚本,该脚本位于Jquery
文件夹中,该文件夹位于根目录中。
js
如果我在HTML页面中尝试这个简单的代码,它可以工作,但不能在外部文件中。 我试着阅读其他答案,但我无法确定问题所在。我是否需要设置LAMP环境才能使其正常工作?
答案 0 :(得分:1)
在外部js文件中,将您的函数放在doc ready函数中:您可以从那里开始修复问题。
$("document").ready(function() {
jQuery(function(){
$("#services h2").text("Hello World");
});
});
还要确保您的/js/myscript.js路径正确无误。要确认您的JQuery已正确加载,请右键单击mozzila中加载的页面&gt;用Firebug检查&gt;选择控制台&gt;然后选择JQuerify选项,它将确认你的jQuery已经成功加载。 (显然如果没有安装firebug,请安装它!)
答案 1 :(得分:0)
在/
之前取消js/myscript.js
如果你这样写它会起作用:
<script type="text/javascript" src="js/myscript.js"></script>