Template:Team:HokkaidoU Japan/About Us/JS

From 2014.igem.org

(Difference between revisions)
Line 1: Line 1:
<html>
<html>
<script type="text/javascript">
<script type="text/javascript">
 +
 +
(function($){
 +
 +
$.fn.skOuterClick = function(method) {
 +
var methods = {
 +
init : function (handler) {
 +
var inners = new Array();
 +
if (arguments.length > 1) for (i = 1; i < arguments.length; i++) {
 +
inners.push(arguments[i]);
 +
}
 +
return this.each(function() {
 +
var self = $(this);
 +
var _this = this;
 +
var isInner = false;
 +
// Bind click event to suppress
 +
function onInnerClick(e){
 +
isInner = true;
 +
};
 +
self.click(onInnerClick);
 +
for (var i = 0; i < inners.length; i++) {
 +
inners[i].click(onInnerClick);
 +
}
 +
// Bind click elsewhere
 +
$(document).click(function(e){
 +
if (!isInner) handler.call(_this, e);
 +
else isInner = false;
 +
});
 +
});
 +
}
 +
};
 +
if (methods[method]) {
 +
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
 +
} else if (typeof method === 'function') {
 +
return methods.init.apply(this, arguments);
 +
} else {
 +
$.error('Method "' + method + '" does not exist in skOuterClick plugin!');
 +
}
 +
};
 +
})(jQuery);
 +
$(".member-click").click(function () {
$(".member-click").click(function () {
Line 14: Line 54:
   });
   });
-
$(".show-ymzk").click(function(){
 
-
    $(".overlay-ymzk").show(500);
 
-
});
 
-
$(".overlay-ymzk").click(function(){
+
$(".overlay").skOuterClick(function(){
       $(this).hide(500);
       $(this).hide(500);
});
});
Line 263: Line 300:
     e.stopPropagation();
     e.stopPropagation();
});
});
 +
 +
</script>
</script>
</html>
</html>

Revision as of 14:57, 29 September 2014