小编Nag*_*jar的帖子

CSS悬停效果转换会改变颜色吗?

我在一个页面中有超过10个按钮,所以我只需要编写一次代码来悬停.因为这个我使用jQuery.请仔细检查我的代码.

$(document).ready(function(){
	$('.button').hover(function(){
    	var bc=$(this).css('background-color');
        var cl=$(this).css('color');
    	$(this).css('background-color',cl);
        $(this).css('color',bc);
           
    });
});
Run Code Online (Sandbox Code Playgroud)
.button {  
  color: #FFFFFF;
  text-align: center;
  font-size: 22px;
  height:70px;
  width: 160px;
  margin: 5px;
  transition: all 0.5s;
  margin-right:30px;
}
.button:hover{
	 transform: scale(1.1);
}
Run Code Online (Sandbox Code Playgroud)
<!DOCTYPE html>
<html>
<head>
<script           src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
</script>
</head>
<body>

  <button class="button" style="background-color: red;">Hover </button>
  <button class="button" style="background-color: green;">Hover </button>
  <button class="button" style="background-color: blue;">Hover </button>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

如果我们连续悬停在按钮上意味着它会改变颜色,那么它是否可以通过单个悬停工作正常,如果有任何其他方法可以避免这种情况?颜色应保持不变.

html javascript css jquery hover

5
推荐指数
1
解决办法
66
查看次数

如何使用批处理文件运行简单的node.js文件

我在Node.js中有一个简单的"Hello World"程序.我想使用批处理文件运行它.

var http=require("http");

http.createServer(function(request,response){
	response.writeHead(200,{'Content-Type':'text/plain'});
	response.end('Hello World!..\n');
}).listen(8080);
console.log('Server running at http://127.0.0.1:8080/');
Run Code Online (Sandbox Code Playgroud)
我使用了名为'new.bat'的批处理文件.

if not "%minimized%"=="" goto :minimized
set minimized=true
@echo off
start /min cmd /c "C:\Users\USER2\Desktop\webchat\server.js"
goto :EOF
:minimized
Run Code Online (Sandbox Code Playgroud)

请帮我.

batch-file node.js

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

batch-file ×1

css ×1

hover ×1

html ×1

javascript ×1

jquery ×1

node.js ×1