Author SHA1 Message Date
Jaime Pillora 64dda76979 Revert "Make a nice top/bottom center global position" 2016-06-09 03:58:15 +10:00
Jaime Pillora 8ba7204c0d Merge pull request #57 from leoding86/master
Make a nice top/bottom center global position
2016-06-09 03:43:22 +10:00
Jaime Pillora 6a2024b997 Merge pull request #54 from tinbka/master
Fixed anchors cache
2016-06-09 03:41:50 +10:00
Jaime Pillora 119d4b2f44 Merge pull request #67 from spartaMatt/master
Introducing 'removeStyle' method
2016-06-09 03:38:37 +10:00
matt dd5adda0bd Introducing 'removeStyle' method 2016-06-08 07:21:22 -04:00
Leo Ding 4bc2d70f4c Make a nice top/bottom center global position
The example is in 'examples/position.html'
2016-02-16 11:55:18 +08:00
Sergey ac9bb74367 Fixed anchors cache
Fixed anchors cache for compatibility with Turbolinks.
"Anchor" element must not be used if it occasionally is out of DOM.
2016-02-05 03:26:48 +03:00
+11 -1
View File
@@ -91,6 +91,15 @@
return styles[name]; return styles[name];
}; };
var removeStyle = function(name) {
if (!name) {
throw "Missing Style name";
}
if (styles[name]) {
delete styles[name];
}
};
var addStyle = function(name, def) { var addStyle = function(name, def) {
if (!name) { if (!name) {
throw "Missing Style name"; throw "Missing Style name";
@@ -337,7 +346,7 @@
var align = positions[pAlign]; var align = positions[pAlign];
var key = pMain + "|" + pAlign; var key = pMain + "|" + pAlign;
var anchor = globalAnchors[key]; var anchor = globalAnchors[key];
if (!anchor) { if (!anchor || !document.contains(anchor[0])) {
anchor = globalAnchors[key] = createElem("div"); anchor = globalAnchors[key] = createElem("div");
var css = {}; var css = {};
css[main] = 0; css[main] = 0;
@@ -551,6 +560,7 @@
$.extend($[pluginName], { $.extend($[pluginName], {
defaults: defaults, defaults: defaults,
addStyle: addStyle, addStyle: addStyle,
removeStyle: removeStyle,
pluginOptions: pluginOptions, pluginOptions: pluginOptions,
getStyle: getStyle, getStyle: getStyle,
insertCSS: insertCSS insertCSS: insertCSS