“User:Sara Lindery/hover”的版本间的差异
小 |
小 (导入1个版本) |
2019年9月4日 (三) 23:43的最新版本
<style>.hover{position:relative}.hoverbefore,.hoverafter{position:absolute;transition:.37s all linear}</style><script>window.RLQ=window.RLQ||[];window.RLQ.push(function(){mw.loader.implement("widgetHover",function($){$(".hover").each(function(){function setHover(){$(_hostContainer).find(".hoverbefore").css("opacity",0);$(_hostContainer).find(".hoverafter").css("opacity",1);_toggleState=!0}function unsetHover(){$(_hostContainer).find(".hoverbefore").css("opacity",1);$(_hostContainer).find(".hoverafter").css("opacity",0);_toggleState=!1}function setDisplayBehavior(){stHoverBeforeDisplayOnHover&&$(_hostContainer).find(".hoverbefore").css("display",stHoverBeforeDisplayOnHover);stHoverAfterDisplayOnHover&&$(_hostContainer).find(".hoverafter").css("display",stHoverAfterDisplayOnHover)}function unsetDisplayBehavior(){$(_hostContainer).find(".hoverbefore").css("display",stHoverBeforeStateBackup);$(_hostContainer).find(".hoverafter").css("display",stHoverAfterStateBackup)}var height=0,width=0,_hostContainer=this,_toggleState=!1;$(this).children().each(function(){$(this).height()>height&&(height=$(this).height());$(this).width()>width&&(width=$(this).width())});/width\s*:\s*\d+px/.test($(this).attr("style"))||$(this).width(width);/height\s*:\s*\d+px/.test($(this).attr("style"))||$(this).height(height);var stHoverBeforeDisplayOnHover=$(this).attr("data-HoverBeforeDisplayOnHover"),stHoverAfterDisplayOnHover=$(this).attr("data-HoverAfterDisplayOnHover"),stHoverBeforeStateBackup=$(this).find(".hoverbefore").css("display"),stHoverAfterStateBackup=$(this).find(".hoverafter").css("display");stHoverBeforeDisplayOnHover||stHoverAfterDisplayOnHover?$(this).find(".hoverbefore").hover(function(){setDisplayBehavior();setHover()},function(){unsetDisplayBehavior();unsetHover()}):$(this).hover(function(){setHover()},function(){unsetHover()});unsetHover()})})});//# sourceMappingURL=HoverWidget.min.js.map</script>