Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

兼容Zepto #115

Merged
merged 1 commit into from
Jan 30, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 9 additions & 7 deletions lib/datav.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*global d3, _, $, jQuery, Raphael, EventProxy */
/*global d3, window, _, $, jQuery, Zepto, Raphael, EventProxy */
/*!
* DataV兼容定义
*/
Expand All @@ -14,6 +14,7 @@
*/
var DataV = function () {};

var DOM = window.jQuery || window.Zepto;
/**
* 版本号
*/
Expand Down Expand Up @@ -376,12 +377,12 @@
return ret;
};

jQuery.fn.wall = function () {
DOM.fn.wall = function () {
return $(this).each(function () {
$(this).css('visibility', 'hidden');
});
};
jQuery.fn.unwall = function () {
DOM.fn.unwall = function () {
return $(this).each(function () {
$(this).css('visibility', 'visible');
});
Expand Down Expand Up @@ -487,7 +488,7 @@
ret = document.getElementById(node);
} else if (node.nodeName) { //DOM-element
ret = node;
} else if (node instanceof jQuery && node.size() > 0) {
} else if (node.size() > 0) {
ret = node[0];
}
if (!ret) {
Expand Down Expand Up @@ -620,7 +621,7 @@
var container;

var floatTag = function (cont) {
container = cont;
container = $(cont);
jqNode = $("<div/>").css({
"border": "1px solid",
"border-color": $.browser.msie ? "rgb(0, 0, 0)" : "rgba(0, 0, 0, 0.8)",
Expand All @@ -638,8 +639,9 @@
"visibility": "hidden",
"position": "absolute"
});
$(container).append(jqNode)
.mousemove(_mousemove);
container.append(jqNode);
container.on('mousemove', _mousemove);
container.on('tap', _mousemove);
jqNode.creator = floatTag;
return jqNode;
};
Expand Down