- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在 laravel 框架中设置 fullCalendar,但由于某种原因它不起作用。
我制作了一个单独的原型(prototype)(没有框架,只有一个 index.html 文件),当我复制该代码时,它突然不再工作了......
我遇到了一个 Uncaught TypeError: $(...).fullCalendar is not a function
错误。
谁能告诉我我做错了什么?
拉拉维尔:应用程序.blade.php
<!DOCTYPE html>
<html lang="<!DOCTYPE html">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Larabase</title>
<script src="{{ asset('bower/jquery/dist/jquery.js') }}"></script>
<script src="{{ asset('bower/moment/moment.js') }}"></script>
<script src="{{ asset('bower/moment/locale/nl.js') }}"></script>
<script src="{{ asset('bower/fullcalendar/dist/fullcalendar.js') }}"></script>
<script src="{{ asset('bower/fullcalendar/dist/lang/nl.js') }}"></script>
<link rel="stylesheet" href="{{ asset('bower/fullcalendar/dist/fullcalendar.css') }}"/>
<link rel="stylesheet" href="{{ asset('bower/fullcalendar/dist/fullcalendar.print.css') }}"/>
@stack('scripts_head_before')
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
{{-- Font Awesome --}}
{{--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">--}}
@stack('scripts_head_after')
</head>
<body>
@include('partials.nav')
<div class="container" style="margin-top: 30px;">
@include('partials.alert')
@yield('content')
</div><!-- /.container -->
@stack('scripts_footer_before')
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
{!! HTML::script('js/global.js') !!}
@stack('scripts_footer_after')
</body>
</html>
laravel: home.blade.php
@extends('app')
@section('content')
<div id='calendar'></div>
<script type="text/javascript">
var events = [
{
title: 'Meeting',
start: '2016-01-12T10:30:00',
end: '2016-01-12T11:30:00'
},
{
title: 'Meeting',
start: '2016-01-12T11:30:00',
end: '2016-01-12T12:30:00'
},
{
title: 'Meeting',
start: '2016-01-12T12:30:00',
end: '2016-01-12T13:30:00'
}
];
$(document).ready(function () {
// page is now ready, initialize the calendar...
$('#calendar').fullCalendar({
// put your options and callbacks here
lang: 'nl',
eventLimit: true,
weekends: true,
firstDay: 1,
weekNumbers: true,
businessHours: {
start: '10:00', // a start time (10am in this example)
end: '18:00', // an end time (6pm in this example)
dow: [1, 2, 3, 4, 5]
// days of week. an array of zero-based day of week integers (0=Sunday)
// (Monday-Thursday in this example)
},
events,
dayClick: function (date, jsEvent, view) {
alert('Clicked on: ' + date.format());
alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
alert('Current view: ' + view.name);
// change the day's background color just for fun
$(this).css('background-color', 'red');
},
eventClick: function (calEvent, jsEvent, view) {
// alert('Event: ' + calEvent.title);
// alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
// alert('View: ' + view.name);
console.log('event', calEvent);
console.log('jsEvent', jsEvent);
console.log('View', view);
// change the border color just for fun
$(this).css('border-color', 'red');
}
});
});
</script>
@stop
index.html 原型(prototype)(有效):
<html>
<head>
<title>Fullcalendar prototype</title>
<link rel='stylesheet' href='bower_components/fullcalendar/dist/fullcalendar.css'/>
<script src='bower_components/jquery/dist/jquery.min.js'></script>
<script src='bower_components/moment/min/moment.min.js'></script>
<script src='bower_components/fullcalendar/dist/fullcalendar.js'></script>
<script src='bower_components/fullcalendar/dist/lang/nl.js'></script>
<script src='bower_components/bootstrap/dist/js/bootstrap.min.js'></script>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css"/>
</head>
<body>
<h1>Fullcalendar prototype
<button id="addbutton" class="btn btn-default">+</button>
</h1>
<div id='calendar'></div>
<script type="text/javascript">
var events = [
{
title: 'Meeting',
start: '2016-01-12T10:30:00',
end: '2016-01-12T11:30:00'
},
{
title: 'Meeting',
start: '2016-01-12T11:30:00',
end: '2016-01-12T12:30:00'
},
{
title: 'Meeting',
start: '2016-01-12T12:30:00',
end: '2016-01-12T13:30:00'
}
];
$(document).ready(function () {
// page is now ready, initialize the calendar...
$('#calendar').fullCalendar({
// put your options and callbacks here
lang: 'nl',
eventLimit: true,
weekends: true,
firstDay: 1,
weekNumbers: true,
businessHours: {
start: '10:00', // a start time (10am in this example)
end: '18:00', // an end time (6pm in this example)
dow: [1, 2, 3, 4, 5]
// days of week. an array of zero-based day of week integers (0=Sunday)
// (Monday-Thursday in this example)
},
events,
dayClick: function (date, jsEvent, view) {
alert('Clicked on: ' + date.format());
alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
alert('Current view: ' + view.name);
// change the day's background color just for fun
$(this).css('background-color', 'red');
},
eventClick: function (calEvent, jsEvent, view) {
// alert('Event: ' + calEvent.title);
// alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
// alert('View: ' + view.name);
console.log('event', calEvent);
console.log('jsEvent', jsEvent);
console.log('View', view);
// change the border color just for fun
$(this).css('border-color', 'red');
}
});
});
</script>
</body>
</html>
最佳答案
编写如下代码:-
app.blade.php
<!DOCTYPE html>
<html lang="<!DOCTYPE html">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Larabase</title>
<script src="{{ asset('bower/jquery/dist/jquery.js') }}"></script>
<script src="{{ asset('bower/moment/moment.js') }}"></script>
<script src="{{ asset('bower/moment/locale/nl.js') }}"></script>
<script src="{{ asset('bower/fullcalendar/dist/fullcalendar.js') }}"></script>
<script src="{{ asset('bower/fullcalendar/dist/lang/nl.js') }}"></script>
<link rel="stylesheet" href="{{ asset('bower/fullcalendar/dist/fullcalendar.css') }}"/>
<link rel="stylesheet" href="{{ asset('bower/fullcalendar/dist/fullcalendar.print.css') }}"/>
@stack('scripts_head_before')
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
{{-- Font Awesome --}}
{{--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">--}}
@stack('scripts_head_after')
</head>
<body>
@include('partials.nav')
<div class="container" style="margin-top: 30px;">
@include('partials.alert')
@yield('content')
</div><!-- /.container -->
@stack('scripts_footer_before')
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
{!! HTML::script('js/global.js') !!}
@stack('scripts_footer_after')
// ADD another yield section here.
@yield('external_script')
</body>
</html>
home.blade.php
@extends('app')
@section('content')
<!-- Add only div here -->
<div id='calendar'></div>
@stop
@section('external_script')
<!-- Here is your script-->
<script type="text/javascript">
var events = [
{
title: 'Meeting',
start: '2016-01-12T10:30:00',
end: '2016-01-12T11:30:00'
},
{
title: 'Meeting',
start: '2016-01-12T11:30:00',
end: '2016-01-12T12:30:00'
},
{
title: 'Meeting',
start: '2016-01-12T12:30:00',
end: '2016-01-12T13:30:00'
}
];
$(document).ready(function () {
// page is now ready, initialize the calendar...
$('#calendar').fullCalendar({
// put your options and callbacks here
lang: 'nl',
eventLimit: true,
weekends: true,
firstDay: 1,
weekNumbers: true,
businessHours: {
start: '10:00', // a start time (10am in this example)
end: '18:00', // an end time (6pm in this example)
dow: [1, 2, 3, 4, 5]
// days of week. an array of zero-based day of week integers (0=Sunday)
// (Monday-Thursday in this example)
},
events,
dayClick: function (date, jsEvent, view) {
alert('Clicked on: ' + date.format());
alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
alert('Current view: ' + view.name);
// change the day's background color just for fun
$(this).css('background-color', 'red');
},
eventClick: function (calEvent, jsEvent, view) {
// alert('Event: ' + calEvent.title);
// alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
// alert('View: ' + view.name);
console.log('event', calEvent);
console.log('jsEvent', jsEvent);
console.log('View', view);
// change the border color just for fun
$(this).css('border-color', 'red');
}
});
});
</script>
@stop
希望对你有帮助:)
关于javascript - FullCalendar 在 laravel 中不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35151117/
今天有小伙伴给我留言问到,try{...}catch(){...}是什么意思?它用来干什么? 简单的说 他们是用来捕获异常的 下面我们通过一个例子来详细讲解下
我正在努力提高网站的可访问性,但我不知道如何在页脚中标记社交媒体链接列表。这些链接指向我在 facecook、twitter 等上的帐户。我不想用 role="navigation" 标记这些链接,因
说现在是 6 点,我有一个 Timer 并在 10 点安排了一个 TimerTask。之后,System DateTime 被其他服务(例如 ntp)调整为 9 点钟。我仍然希望我的 TimerTas
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我就废话不多说了,大家还是直接看代码吧~ ? 1
Maven系列1 1.什么是Maven? Maven是一个项目管理工具,它包含了一个对象模型。一组标准集合,一个依赖管理系统。和用来运行定义在生命周期阶段中插件目标和逻辑。 核心功能 Mav
我是一名优秀的程序员,十分优秀!