我开发了一个应用程序,使用reuire、主干、jquery、jquery、jquery触摸穿孔和锤子。
该应用程序由两个部分组成:可拖动的<li>元素和可下垂区域的<div>。用例是拖动<li>并将其拖放到<div>上。<div>是一个具有缩放和pan功能的时间线。
变焦和pan是使用hammer.js实现的,可以很好地在iPad上工作。对于桌面浏览器,它是使用mousewheel和mousedown事件实现的。
当我使用grunt dist:local -force构建应用程序时,它在桌面和iPad浏览器上工作得很好。但是当我使用grunt dist:prod -force构建它时,它在桌面浏览器上工作得很好,但是停止了在iPad上拖动jquery元素。
请在配置文件下面找到。
requirejs.config({
shim: {
jquery: {
exports: '$'
},
underscore:{
exports: '_'
},
backbone:{
deps : ['jquery', 'underscore'],
exports : 'Backbone'
},
createjs: {
exports : 'createjs'
},
d3:{
deps : ['jquery', 'underscore'],
exports : 'd3'
},
sinon: {
exports : 'sinon'
},
'jquery-ui': {
deps : ['jquery'],
exports : '$'
},
'jquery-ui-core': {
deps : ['jquery'],
exports : '$'
},
'jquery-ui-widget': {
deps : ['jquery-ui-core'],
exports : '$'
},
'jquery-ui-mouse': {
deps : ['jquery-ui-widget'],
exports : '$'
},
'jquery-ui-slider': {
deps : ['jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse'],
exports : '$'
},
'touch-punch': {
deps : ['jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse'],
exports : '$'
},
'transitjs' : {
deps: ['jquery'],
exports: '$'
},
hammerjs: {
exports : 'Hammer'
}
},
paths: {
env : 'environment/local',
text : '../../../bower_components/requirejs-text/text',
jquery : '../../../bower_components/jquery/jquery',
'jquery-ui' : "../../../bower_components/jquery-ui/ui/jquery-ui",
'jquery-ui-core' : "../../../bower_components/jquery-ui/ui/jquery.ui.core",
'jquery-ui-widget' : "../../../bower_components/jquery-ui/ui/jquery.ui.widget",
'jquery-ui-mouse' : "../../../bower_components/jquery-ui/ui/jquery.ui.mouse",
'jquery-ui-slider': "../../../bower_components/jquery-ui/ui/jquery.ui.slider",
underscore : '../../../bower_components/underscore/underscore',
backbone : '../../../bower_components/backbone/backbone',
check : '../../../bower_components/check-js/check.min',
d3 : '../../../bower_components/d3/d3.min',
createjs : '../../../bower_components/createjs/index',
'astro-lib': "../../../bower_components/astro-lib/app/scripts/astro-lib",
'histogramjs': "../../../bower_components/histogramjs",
'transitjs': "../../../bower_components/transitjs/jquery.transit",
'sinon' : "../../../test/libs/sinon-1.4.2",
'hammerjs' : "../../../bower_components/hammerjs/dist/hammer.min",
'touch-punch':"../../../bower_components/jqueryui-touch-punch/jquery.ui.touch-punch"//,
//'polyfill-typedarray' : "../../../bower_components/polyfill/typedarray"
}
});和bower.json
{
"name": "timescaler",
"version": "0.1.0",
"dependencies": {
"jquery": "1.8.3",
"requirejs": "~2",
"requirejs-text": "~2",
"mocha": "~1.6",
"chai": "~1.3",
"chai-jquery": "~1.1.1",
"almond": "~0.2",
"backbone": "~0.9.2",
"jquery-ui": "~1.10.3",
"underscore": "~1.4.2",
"check-js": "~0.1.0",
"flat-ui-official": "",
"font-awesome": "~3.2.1",
"d3":"~3.2.7",
"createjs": "http://code.createjs.com/createjs-2013.02.12.min.js",
"jqueryui-touch-punch": "",
"hammerjs": "~1.0.5",
"polyfill": "https://github.com/inexorabletash/polyfill.git",
"astro-lib": "git@github.com:SmartSparrow/astro-lib.git",
"pipit": "https://github.com/SmartSparrow/pipit-js.git"
}
}jquery触摸-打孔器在grunt dist:prod -force上有什么问题吗?为什么它对桌面浏览器上的grunt dist:local -force很好呢?
发布于 2014-01-08 08:43:49
这是命令在页面上添加jquery-ui和touch-punch的问题。我在touch-punch之前添加了jquery-ui,因此它在grunt dist:prod中不起作用。
https://stackoverflow.com/questions/20867680
复制相似问题