web前端技术笔记(十三)jQuery动画、jquery事件

2023-10-31

jquery动画

通过animate方法可以设置元素某属性值上的动画,可以设置一个或多个属性值,动画执行完成后会执行一个函数。

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		$(function(){

			$('#btn').click(function(){

				$('.box').animate({'width':600},1000,function(){

					$('.box').animate({'height':400},1000,function(){

						$('.box').animate({'opacity':0});

					});
				});

			})

			/*参数可以写成数字表达式:*/
			$('#btn2').click(function(){
				$('.box2').stop().animate({'width':'+=100'});
			})
			


		})



	</script>
	<style type="text/css">
		.box,.box2{
			width:100px;
			height:100px;
			background-color:gold;
		}
	</style>
</head>
<body>
	<input type="button" name="" value="动画" id="btn">
	<div class="box"></div>

	<br />
	<br />
	<input type="button" name="" value="动画" id="btn2">
	<div class="box2"></div>
</body>
</html>

滑动选项卡案例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		.btns input{
			width:100px;
			height:40px;
			background-color:#ddd;
			border:0;
			outline:none;
		}
		.btns .current{
			background-color:gold;
		}
		.cons{
			width:500px;
			height:300px;
			overflow:hidden;
			position:relative;
		}
		.slides{
			width:1500px;
			height:300px;
			position:absolute;
			left:0;
			top:0;
		}
		.cons .slides div{
			width:500px;
			height:300px;
			background-color:gold;
			text-align:center;
			line-height:300px;
			font-size:30px;
			float:left;
		}

		.cons .active{
			display: block;
		}

	</style>
	<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		$(function(){
			var $btn = $('.btns input');
			var $slides = $('.cons .slides');

			$btn.click(function(){
				// this 指的是原生的this,它表示当前点击的对象,使用jquery的对象需要用$(this)

				// 当前点击的按钮加上current样式后,除了当前,其他的按钮去掉current样式
				$(this).addClass('current').siblings().removeClass('current');
				$slides.stop().animate({'left':-500*$(this).index()});

				
			})
		})

	</script>
</head>
<body>
	<div class="btns">
		<input type="button" name="" value="01" class="current">
		<input type="button" name="" value="02">
		<input type="button" name="" value="03">
	</div>	
	<div class="cons">
		<div class="slides">
			<div>选项卡一的内容</div>
			<div>选项卡二的内容</div>
			<div>选项卡三的内容</div>
		</div>
	</div>
</body>
</html>

尺寸相关、滚动事件

1、获取和设置元素的尺寸

width()、height()    获取元素width和height  
innerWidth()、innerHeight()  包括padding的width和height  
outerWidth()、outerHeight()  包括padding和border的width和height  
outerWidth(true)、outerHeight(true)   包括padding和border以及margin的width和height
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		$(function(){

			var $div = $('.box');

			// 盒子内容的尺寸
			console.log($div.width());
			console.log($div.height());


			// 盒子内容加上padding的尺寸
			console.log($div.innerWidth());
			console.log($div.innerHeight());


			//盒子的真实尺寸,内容尺寸+padding+border
			console.log($div.outerWidth());
			console.log($div.outerHeight());

			// 盒子的真实尺寸再加上margin
			console.log($div.outerWidth(true));
			console.log($div.outerHeight(true));



		})



	</script>
	<style type="text/css">
		
		.box{
			width:300px;
			height:200px;
			padding:20px;
			border:10px solid #000;
			margin:20px;
			background-color:gold;
		}


	</style>
</head>
<body>
	<div class="box"></div>
</body>
</html>

2、获取元素相对页面的绝对位置

offset()
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		
		$(function(){

			var $div = $('.box');


			$div.click(function(){		

				var oPos = $div.offset();

				document.title = oPos.left + "|" + oPos.top;

			})

			

			//console.log(oPos);


		})


	</script>
</head>
<style type="text/css">
	.box{
		width:200px;
		height:200px;
		background-color:gold;
		margin:50px auto 0;
	}
</style>
<body>
	<div class="box">
		
	</div>
</body>
</html>

加入购物车案例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		
		.chart{
			width:150px;
			height:50px;
			border:2px solid #000;
			text-align:center;
			line-height:50px;
			float:right;
			margin-right:100px;
			margin-top:50px;
		}

		.chart em{
			font-style: normal;
			color:red;
			font-weight:bold;
		}


		.add{
			width:100px;
			height:50px;
			background-color:green;
			border:0;
			color:#fff;
			float:left;
			margin-top:300px;
			margin-left:300px;
		}

		.point{
			width:16px;
			height:16px;
			background-color:red;
			position:fixed;
			left:0;
			top:0;
			display:none;
			z-index:9999;
			border-radius:50%;
		}

	</style>
	<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		$(function(){
			var $chart = $('.chart');
			var $count = $('.chart em');
			var $btn = $('.add');
			var $point = $('.point');

			var $w01 = $btn.outerWidth();
			var $h01 = $btn.outerHeight();

			var $w02 = $chart.outerWidth();
			var $h02 = $chart.outerHeight();

			$btn.click(function(){
				var oPos01 = $btn.offset();
				var oPos02 = $chart.offset();
				$point.css({'left':oPos01.left+parseInt($w01/2)-8,'top':oPos01.top+parseInt($h01/2)-8});
				$point.show();

				$point.stop().animate({'left':oPos02.left+parseInt($w02/2)-8,'top':oPos02.top+parseInt($h02/2)-8},800,function(){
					$point.hide();
					var iNum = $count.html();
					$count.html(parseInt(iNum)+1);
				});
			})
		});
	</script>
</head>
<body>
	<div class="chart">购物车<em>0</em></div>
	<input type="button" name="" value="加入购物车" class="add">
	<div class="point"></div>
</body>
</html>

3、获取浏览器可视区宽度高度

$(window).width();
$(window).height();

4、获取页面文档的宽度高度

$(document).width();
$(document).height();

5、获取页面滚动距离

$(document).scrollTop();  
$(document).scrollLeft();

在这里插入图片描述
6、页面滚动事件

$(window).scroll(function(){  
    ......  
})

菜单吸顶案例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		
		body{
			margin:0;
		}

		.banner{
			width:960px;
			height:200px;
			background-color:cyan;
			margin:0 auto;
		}

		.menu{
			width:960px;
			height:80px;
			background-color:gold;
			margin:0 auto;
			text-align:center;
			line-height:80px;
		}

		.menu_back{
			width:960px;
			height:80px;
			margin:0 auto;
			display:none;
		}

		p{
			text-align:center;
			color:red;
		}

		.totop{
			width:60px;
			height:60px;
			background-color:#000;
			color:#fff;
			position:fixed;
			right:20px;
			bottom:50px;
			line-height:60px;
			text-align:center;
			font-size:40px;
			border-radius:50%;
			cursor:pointer;
			display:none;
		}

	</style>
	<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		$(function(){
			$menu = $('.menu');
			$menu_back = $('.menu_back');
			$totop = $('.totop');

			$(window).scroll(function(){
				//console.log('abc');

				var iNum = $(document).scrollTop();
				//document.title = iNum;

				if(iNum>200)
				{
					$menu.css({
						'position':'fixed',
						'left':'50%',
						'top':0,
						'marginLeft':-480
					});

					$menu_back.show();
				}
				else
				{
					$menu.css({
						'position':'static',						
						'marginLeft':'auto'
					});

					$menu_back.hide();
				}


				if(iNum>400){
					$totop.fadeIn();
				}
				else
				{
					$totop.fadeOut();
				}

			})
			$totop.click(function(){
				$('html,body').animate({'scrollTop':0});
			})


		})



	</script>
</head>
<body>
	<div class="banner"></div>
	<div class="menu">菜单</div>
	<div class="menu_back"></div>

	<div class="totop"></div>

	<p>文档内容</p>
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<p>文档内容</p>
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<p>文档内容</p>
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<p>文档内容</p>
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
	<br />
 
</body>
</html>

jquery属性操作

1、html() 取出或设置html内容

// 取出html内容

var $htm = $('#div1').html();

// 设置html内容

$('#div1').html('<span>添加文字</span>');

2、prop() 取出或设置某个属性的值

// 取出图片的地址

var $src = $('#img1').prop('src');

// 设置图片的地址和alt属性

$('#img1').prop({src: "test.jpg", alt: "Test Image" });
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		$(function(){

			var $a = $('.link');
			var $img = $('#img01');
			var $div = $('#div1');

			// 读取class属性值
			console.log( $a.prop('class') );

			// 没有设置的属性读取为空
			console.log( $a.prop('title') );


			// 获取是图片的绝对地址
			console.log($img.prop('src'));

			//alert($img.prop('src'));


			// 设置属性
			$a.prop({'href':'http://www.baidu.com','title':'百度网链接'});


			//console.log( $a.prop('title') );

			//读取标签内包含的内容
			console.log( $a.html() );

			$div.html('<span>div里面的span元素</span>');



		})


	</script>
</head>
<body>
	<a href="#" class="link">这是一个链接</a>
	<img src="images/002.jpg" id="img01" alt="水果">

	<div id="div1"></div>

</body>
</html>

jquery循环

对jquery选择的对象集合分别进行操作,需要用到jquery循环操作,此时可以用对象上的each方法:

$(function(){
    $('.list li').each(function(i){
        $(this).html(i);
    })
})
......
<ul class="list">
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
</ul>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		$(function(){

			var $li = $('.list li');

			//$li.css({'backgroundColor':'gold'});

			$li.each(function(a){

				//alert(a);
				//alert( $(this).html() );

				//alert($(this).index());

				if($(this).index()%2==0)
				{
					$(this).css({'backgroundColor':'gold'});
				}

			})




		})



	</script>
</head>
<body>
	<ul class="list">
		<li>1</li>
		<li>2</li>
		<li>3</li>
		<li>4</li>
		<li>5</li>
		<li>6</li>
		<li>7</li>
		<li>8</li>
	</ul>
</body>
</html>

手风琴格局案例

在这里插入图片描述

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
<style>
*{margin:0;padding:0;}
body{font-size:12px;}
#accordion{width:727px; height:350px; margin:100px auto 0 auto; position:relative; overflow:hidden; border:1px solid #CCC;}
#accordion ul{list-style:none;}
#accordion ul li{width:643px;height:350px; position:absolute; background:#FFF;}
#accordion ul li span{display:block;width:20px; height:350px; float:left; text-align:center; color:#FFF; padding-top:5px; cursor:pointer;}
#accordion ul li img{display:block; float:right;}
.bar01{left:0px;}
.bar02{left:643px;}
.bar03{left:664px;}
.bar04{left:685px;}
.bar05{left:706px;}
.bar01 span{background:#09E0B5;}
.bar02 span{background:#3D7FBB;}
.bar03 span{background:#5CA716;}
.bar04 span{background:#F28B24;}
.bar05 span{background:#7C0070;}
</style>

<script type="text/javascript">


		$(function(){

			var $li = $('#accordion li');

			$li.click(function(){

				//alert($(this).html());
				$(this).animate({'left':21*$(this).index()});

				//点击的li前面的li向左运动到各自的位置
				$(this).prevAll().each(function(){

					//这里的$(this)指的是循环选择的每个li
					$(this).animate({'left':21*$(this).index()});

				})


				//   第5个li在右边的left值   727-21*1 等同于 727-21*(5-$(this).index())
				//   第4个li在右边的left值   727-21*2 等同于 727-21*(5-$(this).index())
				//   第3个li在右边的left值   727-21*3 等同于 727-21*(5-$(this).index())

				$(this).nextAll().each(function(){

					$(this).animate({'left':727-21*(5-$(this).index())});

				})



			})



		})


</script>


<title>手风琴效果</title>
</head>

<body>
<div id="accordion">
	<ul>
	<li class="bar01"><span>非洲景色01</span><img src="images/001.jpg" /></li>
    <li class="bar02"><span>非洲景色02</span><img src="images/002.jpg" /></li>
    <li class="bar03"><span>非洲景色03</span><img src="images/003.jpg" /></li>
    <li class="bar04"><span>非洲景色04</span><img src="images/004.jpg" /></li>
    <li class="bar05"><span>非洲景色05</span><img src="images/005.jpg" /></li>
	</ul>
</div>
</body>
</html>

jquery事件

事件函数列表:

blur() 元素失去焦点
focus() 元素获得焦点
click() 鼠标单击
mouseover() 鼠标进入(进入子元素也触发)
mouseout() 鼠标离开(离开子元素也触发)
mouseenter() 鼠标进入(进入子元素不触发)
mouseleave() 鼠标离开(离开子元素不触发)
hover() 同时为mouseenter和mouseleave事件指定处理函数
ready() DOM加载完成
resize() 浏览器窗口的大小发生改变
scroll() 滚动条的位置发生变化
submit() 用户递交表单
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		
		$(function(){


			// 在获得焦点的时候做什么事情
			/*$('#input01').focus(function(){
				alert('获得焦点')
			})*/

			//focus 一般用来让input元素开始就获取焦点,只能是一个元素获得焦点
			$('#input01').focus();


			$('#input01').blur(function(){

				// 获取input元素的value值用 val()
				var sVal = $(this).val();
				alert(sVal);

			})


			$('#form1').submit(function(){

				//alert('提交');

				// 阻止默认的提交行为
				return false;

			})


		})

	</script>
</head>
<body>
	<form id="form1" action="http://www.baidu.com">
		<input type="text" name="dat01" id="input01">
		<input type="text" name="dat02" id="input02">
		<input type="submit" name="" value="提交" id="sub">
	</form>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		
		$(function(){

			// 鼠标移入,移入的子元素也会触发
			$('.con').mouseover(function(){
				alert('移入');
			})

			$('.con').mouseout(function(){
				alert('移出');
			})


			// 鼠标移入,移入的子元素不会触发
			/*

			$('.con2').mouseenter(function(){
				alert('移入');
			})

			$('.con2').mouseleave(function(){
				alert('移出');
			})
			
			合并成下面的写法:

			*/


			$('.con2').hover(function(){
				alert('移入')
			},function(){
				alert('移出')
			})



		})




	</script>
	<style type="text/css">
		.con,.con2{
			width:200px;
			height:200px;
			background-color:gold;
		}

		.box,.box2{
			width:100px;
			height:100px;
			background-color:green;
		}
	</style>
</head>
<body>
	<div class="con">
		<div class="box"></div>
	</div>
	
	<br />
	<br />
	<br />
	<br />


	<div class="con2">
		<div class="box2"></div>
	</div>


</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		
		$(window).resize(function(){

			var $w = $(window).width();

			document.title = $w;


		});



	</script>
</head>
<body>
	
</body>
</html>

绑定事件的其他方式

$(function(){
    $('#div1').bind('mouseover click', function(event) {
        alert($(this).html());
    });
});

取消绑定事件

$(function(){
    $('#div1').bind('mouseover click', function(event) {
        alert($(this).html());

        // $(this).unbind();
        $(this).unbind('mouseover');

    });
});
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		$(function(){

			/*
			$('#btn').click(function(){
				
				alert('click事件')
		
			})

			*/


			// 点击或者鼠标移入的时候都执行绑定的函数
			$('#btn').bind('click mouseover',function(){

				alert('触发事件绑定的函数');

				$(this).unbind('mouseover');

			})

		})

	</script>
</head>
<body>
	<input type="button" name="" value="按钮" id="btn">
</body>
</html>

事件冒泡

什么是事件冒泡

在一个对象上触发某类事件(比如单击onclick事件),如果此对象定义了此事件的处理程序,那么此事件就会调用这个处理程序,如果没有定义此事件处理程序或者事件返回true,那么这个事件会向这个对象的父级对象传播,从里到外,直至它被处理(父级对象所有同类事件都将被激活),或者它到达了对象层次的最顶层,即document对象(有些浏览器是window)。

事件冒泡的作用

事件冒泡允许多个操作被集中处理(把事件处理器添加到一个父级元素上,避免把事件处理器添加到多个子级元素上),它还可以让你在对象层的不同级别捕获事件。

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		$(function(){
				// event 是发生事件的时候的事件对象,使用的时候,通过第一个参数传进来
				$('.son').click(function(event){
					
					alert(1);

					//通过event对象上的stopPropagation的方法阻止事件冒泡
					//event.stopPropagation();

				})

				$('.father').click(function(event){
					alert(2);

					event.stopPropagation();
				})	

				$('.grandfather').click(function(){
					alert(3);

					// 阻止事件冒泡和阻止默认行为的统一写法:
					return false;
				})


				$(document).click(function(){
					alert(4);
				})

		})

	</script>
	<style type="text/css">
		
		.grandfather{
			width:300px;
			height:300px;
			background-color:green;

			position:relative;
		}

		.father{
			width:200px;
			height:200px;
			background-color:gold;
		}


		.son{
			width:100px;
			height:100px;
			background-color: red;
			position:absolute;

			left:0;

			top:400px;
		}



	</style>
</head>
<body>
	<div class="grandfather">		
		<div class="father">			
			<div class="son"></div>
		</div>
	</div>
</body>
</html>

阻止事件冒泡

事件冒泡机制有时候是不需要的,需要阻止掉,通过 event.stopPropagation() 来阻止

阻止默认行为

阻止表单提交

$('#form1').submit(function(event){
    event.preventDefault();
})

合并阻止操作

实际开发中,一般把阻止冒泡和阻止默认行为合并起来写,合并写法可以用

// event.stopPropagation();
// event.preventDefault();

// 合并写法:
return false;

阻止事件冒泡完成弹窗案例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		$(function(){

			$('#btn').click(function(){
				$('.pop_con').fadeIn();
				return false;

			})
			$(document).click(function(){
				$('.pop_con').fadeOut();

			})
			$('.pop').click(function(){

				return false;

			})
			$('#close').click(function(){
				$('.pop_con').fadeOut();
			})

		})


	</script>
	<style type="text/css">

		.pop_con{
			display:none;
		}		
		.pop{
			position:fixed;
			width:500px;
			height:300px;
			background-color:#fff;
			border:3px solid #000;
			left:50%;
			top:50%;
			margin-left:-250px;
			margin-top:-150px;
			z-index:9999;
		}

		.mask{
			position:fixed;
			width:100%;
			height:100%;
			background-color:#000;
			opacity:0.3;
			filter:alpha(opacity=30);
			left:0;
			top:0;
			z-index:9990;

		}

		.close{
			float:right;
			font-size:30px;
		}



	</style>
</head>
<body>
	<input type="button" name="" value="弹出" id="btn">

	<div class="pop_con">
		<div class="pop">
			弹框里面文字
			投资金额:
			<input type="text" name="">
			<a href="#" id="close" class="close">×</a>
		</div>
		<div class="mask"></div>
	</div>
</body>
</html>

事件委托

事件委托就是利用冒泡的原理,把事件加到父级上,通过判断事件来源的子集,执行相应的操作,事件委托首先可以极大减少事件绑定次数,提高性能;其次可以让新加入的子元素也可以拥有相同的操作。

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		
		.list{
			background-color:gold;
			list-style:none;
			padding:10px;
		}

		.list li{
			height:30px;
			background-color:green;
			margin:10px;
		}


	</style>
	<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		$(function(){

		

			/* 一般绑定事件的写法

			$('.list li').click(function(){

				$(this).css({'backgroundColor':'red'});

			});

			*/


			// 新建一个li元素赋值给$li变量
			//var $li = $('<li>9</li>');

			//让新加的li有相同的事件,需要单独绑定
			//$li.click(....)

			// 把新建的li元素放到ul子集的最后面
			//$('.list').append($li);		

			
			//事件委托,将li要发生的事件委托给li的父级
			$('.list').delegate('li','click',function(){
				//$(this) 指的是委托的子元素
				$(this).css({'backgroundColor':'red'});

			})

			var $li = $('<li>9</li>');
			$('.list').append($li);

		})

	</script>
</head>

<body>
	<ul class="list">
		<li>1</li>
		<li>2</li>
		<li>3</li>
		<li>4</li>
		<li>5</li>
		<li>6</li>
		<li>7</li>
		<li>8</li>
	</ul>
</body>
</html>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

web前端技术笔记(十三)jQuery动画、jquery事件 的相关文章

随机推荐

  • three.js加载fbx并解析骨骼动画

    three js加载fbx并解析骨骼动画 话不多说 上代码
  • SpringBoot如何打包项目?

    我们打包SpringBoot项目一般是打包成jar包或者war包 jar包和war包最大的区别在于jar包打出来的可直接运行 我们可以直接进行访问 因为他内前置了tomcat服务器 但是war包在打包的时候会提前移除tomcat相关组件 我
  • Verilog入门——Quartus2基础使用

    一 新建工程 1 打开Quartus2 2 点击菜单栏中的 file 选择 New Project Wizard 3 点击Next 4 选择工程存储路径 5 输入工程名字 6 点击Next 7 选择fpga类型和型号 根据自己的板子型号选择
  • 最简单的DRM应用程序 (single-buffer)

    在上一篇DRM Direct Rendering Manager 学习简介 中 我们学习了DRM的基本概念以及基本组成元素 从本篇开始 我将以示例代码的形式 给大家分享学习DRM驱动开发的整个学习过程 在学习DRM驱动之前 应该首先了解如何
  • 【java】ssh the connection is not authenticated

    文章目录 1 概述 1 概述 首先参考 java java ssh 远程执行命令 并且获取执行的结果 然后讲述一下 这个问题 这是一段很久的代码 以前是能正常工作的 环境如下 Docker flink node 这里ssh kafka no
  • QT笔记-窗体设置

    1 窗体设置 个窗体初始运行最大化 setWindowState Qt WindowMaximized 获取屏幕分别率 并设置窗体固定大小 QScreen screen QGuiApplication primaryScreen QRect
  • MySQL 日期相减得到秒、分、天

    文章目录 一 MySQL中两个DateTime字段相减 二 MySQL中两个Time字段相减 一 MySQL中两个DateTime字段相减 这种方式两字段跨天 月 年都无问题 得到两个日期字段之间的秒数 selec t UNIX TIMES
  • 医学影像组学之病理切片分割(免费训练数据,标注数据,免费代码,免费教程)三天走完影像组学全部流程

    谁规定说影像组学只能从写代码 学语言耗费半年时间才能开始实验 三天让你走完影像组学完整流程 训练数据已经集成好 标注数据也已备好 代码也备好了 训练过程是这样的 另外笔者整理了其他影像组学的教学小视频 有兴趣的可以在下面评论
  • 华为HCIE云计算之部署Fusion Access及云桌面发放实战

    华为HCIE云计算之部署Fusion Access及云桌面发放实战 一 在FC上安装FA01虚拟机 1 选择创建类型 2 创建虚拟机基本配置 3 创建数据存储 4 选择虚拟机配置 5 虚拟机创建完成 二 安装FA01系统 1 进入系统安装界
  • 以太坊入门学习资料

    区块链分类 区块链按照访问和管理权限分为公有链 联盟链和私有链 公有链 完全开放 所有节点均可加入 代表链 比特币Bitcoin 以太坊Ethereum 联盟链 有多个组织和机构共同管理 获得组织和机构许可的节点可以加入 代表链 超级账本H
  • uniapp弹窗实现

  • java comparable与_详解Java中Comparable和Comparator接口的区别

    详解Java中Comparable和Comparator接口的区别 本文要来详细分析一下Java中Comparable和Comparator接口的区别 两者都有比较的功能 那么究竟有什么区别呢 感兴趣的Java开发者继续看下去吧 Compa
  • string.h的strcmp的性能比较

    string h基于汇编实现strcmp 和普通strcmp 针对循环调用次数和字符串查找长度2个纬度做了一次性能对比效测试 include
  • Windows 安装 nvm

    最近安装了最新版的node js之后 发现一个问题 版本太高 有些vue项目运行不起来了 于是找解决办法 发现安装 nvm 可以解决这个问题 nvm全名node js version management 是一个nodejs的版本管理工具
  • 哈夫曼树的应用

    温馨提示 这篇文章是基于哈夫曼树的构建之上 来说说哈夫曼树的应用 强烈建议在学习http 124 222 190 191 8090 archives E5 93 88 E5 A4 AB E6 9B BC E6 A0 91 E7 9A 84
  • 滤波电容计算举例

    例 输入电压220VAC 功率4W 要求输出电压波动不超过5 试计算滤波电容容量 解 1 电容的储能公式为 Wc 1 2CU 2 当电容充电到峰值电压 即220x1 414 310V 时 电容储存能量最大为 Wc max 1 2CU 2 0
  • 点估计(矩估计法和最大似然估计法)

    估计即是近似地求某个参数的值 需要区别理解样本 总体 量 值 大致的题型是已知某分布 其实包含未知参数 从中取样本并给出样本值 我只是一个初学者 可能有的步骤比较繁琐 请见谅 1 矩估计法 做题步骤 1 E x 求总体均值 一般含有未知参数
  • 为什么需要自动化测试?软件测试师带你测评不同软件测试工具

    软件从桌面转移到了我们接触到的几乎所有东西 从智能恒温器到输液泵再到汽车 软件无孔不入 而且在不断增长 来自物联网 IoT 的所谓 东西 越来越多地携带更多的逻辑 随之而来的是更大的故障风险 这些设备中的许多被用于安全关键领域 如医疗和汽车
  • 在Windows上使用gcc编译器

    在Windows上使用gcc编译器 第一步 安装QT 第二步 找到qt文件夹下的bin目录 如下所示 第三步 将该目录配置到环境变量中 第四步 打开cmd 输入gcc v 出现下面的图片证明gcc配置成功 第五步 编写一个 c文件进行测试
  • web前端技术笔记(十三)jQuery动画、jquery事件

    jQuery jquery动画 滑动选项卡案例 尺寸相关 滚动事件 加入购物车案例 菜单吸顶案例 jquery属性操作 jquery循环 手风琴格局案例 jquery事件 绑定事件的其他方式 取消绑定事件 事件冒泡 什么是事件冒泡 事件冒泡