Javascript 为什么在缩小和合并时此滑块脚本会中断?
是时候缩小我的js了,我遇到了一些脚本,只是不想: 首先我们有猫头鹰滑块。我有几个滑块和一些其他随机的JS,希望我能结合起来Javascript 为什么在缩小和合并时此滑块脚本会中断?,javascript,jquery,minify,Javascript,Jquery,Minify,是时候缩小我的js了,我遇到了一些脚本,只是不想: 首先我们有猫头鹰滑块。我有几个滑块和一些其他随机的JS,希望我能结合起来 $(document).ready(function() { $("#sliderId").owlCarousel({ autoPlay:true, navigation : false, slideSpeed : 200, paginationSpeed : 400, items: 3, loop:true, itemsTa
$(document).ready(function() {
$("#sliderId").owlCarousel({
autoPlay:true,
navigation : false,
slideSpeed : 200,
paginationSpeed : 400,
items: 3,
loop:true,
itemsTablet: true,
itemsMobile : true
});
});
第二个旧脚本用于显示随机文本:
$(document).ready(function change() {
"use strict";
var messages = [
"text 1",
"text 2",
], i = 0;
var msg = messages[Math.floor(Math.random()*messages.length)];
$('#comments').html(msg).fadeIn(600).delay(10000).fadeOut(600, change);
})();
我怎么可能把这两个文件合并成一个js文件来运行呢 缩小器在某些情况下非常严格。因此,您的Javascript文件中有一个小小的逗号错误:
$(document).ready(function change() {
"use strict";
var messages = [
"text 1",
"text 2" // Here you have to delete the comma
], i = 0;
var msg = messages[Math.floor(Math.random()*messages.length)];
$('#comments').html(msg).fadeIn(600).delay(10000).fadeOut(600, change);
})();
解决这个问题,也许你最喜欢的迷你和组合器可以工作;)