0
A
回答
2
我试了一下,跑进两个问题。首先,flot
寻找被定义的jQuery
,而第二,flot
使用outerWidth
,其中zepto不是replicate。
所以,让我们给它一点爱和解决这些问题:
<!DOCTYPE html>
<html>
<head>
<script>
</script>
<!-- Load Zepto -->
<script data-require="[email protected]" data-semver="1.1.4" src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.1.4/zepto.min.js"></script>
<!-- patch in the things we need -->
<script>
// define jquery
jQuery = $;
// create outerWidth/Height functions
// stolen from here: https://gist.github.com/pamelafox/1379704
['width', 'height'].forEach(function(dimension) {
var offset, Dimension = dimension.replace(/./, function(m) {
return m[0].toUpperCase()
});
$.fn['outer' + Dimension] = function(margin) {
var elem = this;
if (elem) {
var size = elem[dimension]();
var sides = {
'width': ['left', 'right'],
'height': ['top', 'bottom']
};
sides[dimension].forEach(function(side) {
if (margin) size += parseInt(elem.css('margin-' + side), 10);
});
return size;
} else {
return null;
}
};
});
</script>
<!-- now we can include flot -->
<script data-require="[email protected]" data-semver="0.8.2" src="//cdnjs.cloudflare.com/ajax/libs/flot/0.8.2/jquery.flot.min.js"></script>
</head>
<body>
<div id="placeholder" style="width:300px;height:300px"></div>
<script>
$(function() {
var d1 = [];
for (var i = 0; i < 14; i += 0.5) {
d1.push([i, Math.sin(i)]);
}
var d2 = [
[0, 3],
[4, 8],
[8, 5],
[9, 13]
];
// A null signifies separate line segments
var d3 = [
[0, 12],
[7, 12], null, [7, 2.5],
[12, 2.5]
];
$.plot("#placeholder", [d1, d2, d3]);
});
</script>
</body>
</html>
相关问题
- 1. 如何使用requirejs与zepto
- 2. 在jQuery集合上使用Zepto方法
- 3. Zepto使用array.filter
- 4. jQtouch与jQuery不Zepto
- 5. Flot - 将水平时间线与“标准”线结合
- 6. FLOT或Flotr2烛台与线(结合系列)
- 7. zepto应用程序结构 - phonegap
- 8. 在jQuery Mobile中使用Zepto
- 9. Html.Raw()与Razor结合使用?
- 10. 与Monotouch结合使用PonyDebugger?
- 11. PHPExcel:结合使用“getHighestRow”与
- 12. 结合使用mime_content_type与ACF
- 13. 结合使用str_replace与ut8_decode
- 14. ob_start()与wp_query结合使用
- 15. 如何在动画结束时使用Zepto来调用函数?
- 16. 使用Flot jQuery插件与PHP和MySQL
- 17. SignalR与Flot
- 18. 使用holoeverywhere与actionBarSherlock结合使用
- 19. 使用选择2用的Zepto
- 20. @ types/zepto阻止我导入zepto本身
- 21. 将淘汰赛结合与selectOrDie结合使用
- 22. jquery flot缓慢冻结IE
- 23. 使用zepto,可以排列动画吗?
- 24. 使用Modernizr和Zepto时window.resize失败
- 25. 将Specflow与Web服务结合使用
- 26. Java Swing:将RowFilter.andFilter与RowFilter.orFilter结合使用
- 27. 将PDF与rails结合使用combine_pdf
- 28. 将Hadoop DistributedCache与存档结合使用
- 29. 将jQuery与SQL结合使用
- 30. Angular2 ViewChildren与transclusion结合使用