jQuery移动光标改变图像特效代码

版权:原创 更新时间:1年以上
[该文章底部包含文件资源,可根据自己情况,决定是否下载资源使用,时间>金钱,如有需要,立即查看资源]

以下是 jQuery移动光标改变图像特效代码 的示例演示效果:

当前平台(PC电脑)
  • 平台:

部分效果截图:

jQuery移动光标改变图像特效代码

HTML代码(index.html):

<!doctype html>
<html>
<head>
	<meta charset="gb2312">
	<title>jQuery移动光标改变图像</title>
	<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
  <script type="text/javascript" src="js/jquery.shuffle-images.js"></script>
  <style>
    html {
      height: 100%;
    }
    body {
      background: #fff;
      padding: 0;
      text-align: center;
      font-family: 'Open Sans';
      position: relative;
      margin: 0;
      height: 100%;
      -webkit-font-smoothing: antialiased;
      text-rendering: optimizelegibility;
    }
    
    a {
      color: black;
    }
    
    .header {
      padding: 30px 0 0;
      float: left;
      width: 100%;
      background: white;
    }
    
    .wrapper {
    	height: auto !important;
    	height: 100%;
    	margin: 0 auto; 
    	overflow: hidden;
    }
    
    a {
      text-decoration: none;
    }
    
    
    h1, h2 {
      width: 100%;
      float: left;
    }
    h1 {
      margin-top: 100px;
      color: #999;
      margin-bottom: 5px;
      font-size: 70px;
      font-weight: 100;
    }
    h2 {
      padding: 00px 20px 30px 20px;
      box-sizing: border-box;
      -webkit-box-sizing: border-box;
      -moz-box-sizing: border-box;
      letter-spacing: 0px;
      color: #888;
      font-size: 20px;
      line-height: 160%;
      font-weight: 100;
      margin-top: 10px;
      margin-bottom: 0;
    }
    
    
    .pointer {
      color: #00B0FF;
      font-family: 'Pacifico';
      font-size: 24px;
      margin-top: 15px;
      position: absolute;
      top: 130px;
      right: -40px;
    }
    .pointer2 {
      color: #00B0FF;
      font-family: 'Pacifico';
      font-size: 24px;
      margin-top: 15px;
      position: absolute;
      top: 130px;
      left: -40px;
    }
    pre {
      margin: 80px auto;
    }
    pre code {
      padding: 35px;
      border-radius: 5px;
      font-size: 15px;
      background: rgba(0,0,0,0.1);
      border: rgba(0,0,0,0.05) 5px solid;
      max-width: 500px;
    }


    .main {
      float: left;
      width: 100%;
      margin: 0 auto;
    }
    
    
    .main h1 {
      padding:20px 50px 10px;
      float: left;
      width: 100%;
      font-size: 60px;
      box-sizing: border-box;
      -webkit-box-sizing: border-box;
      -moz-box-sizing: border-box;
      font-weight: 100;
      margin: 0;
      padding-top: 25px;
      font-family: 'Open Sans';
      letter-spacing: -1px;
      text-transform: capitalize;
    }
   
    .main h1.demo1 {
      background: #1ABC9C;
    }
    
    .reload.bell {
      font-size: 12px;
      padding: 20px;
      width: 45px;
      text-align: center;
      height: 47px;
      border-radius: 50px;
      -webkit-border-radius: 50px;
      -moz-border-radius: 50px;
    }
    
    .reload.bell #notification {
      font-size: 25px;
      line-height: 140%;
    }
    
    .reload, .btn{
      display: inline-block;
      border-radius: 3px;
      -moz-border-radius: 3px;
      -webkit-border-radius: 3px;
      display: inline-block;
      line-height: 100%;
      padding: 0.7em;
      text-decoration: none;
      width: 100px;
      line-height: 140%;
      font-size: 17px;
      font-family: Open Sans;
      font-weight: bold;
      -webkit-box-shadow: none;
      box-shadow: none;
      background-color: #4D90FE;
      background-image: -webkit-linear-gradient(top,#4D90FE,#4787ED);
      background-image: linear-gradient(top,#4d90fe,#4787ed);
      border: 1px solid #3079ED;
      color: #FFF;
    }
    .reload:hover{
      background: #317af2;
    }
    .btn {
      width: 200px;
      -webkit-box-shadow: none;
      box-shadow: none;
      background-color: #4D90FE;
      background-image: -webkit-linear-gradient(top,#4D90FE,#4787ED);
      background-image: linear-gradient(top,#4d90fe,#4787ed);
      border: 1px solid #3079ED;
      color: #FFF;
    }
    .clear {
      width: auto;
    }
    .btn:hover, .btn:hover {
      background: #317af2;
    }
    .btns {
      width: 410px;
      margin: 50px auto;
    }
    .credit {
      text-align: center;
      color: #888;
      padding: 10px 10px;
      margin: 0 0 0 0;
      float: left;
      width: 100%;
    }
    .credit a {
      text-decoration: none;
      font-weight: bold;
      color: black;
    }
    
    .back {
      position: absolute;
      top: 0;
      left: 0;
      text-align: center;
      display: block;
      padding: 7px;
      width: 100%;
      box-sizing: border-box;
      -moz-box-sizing: border-box;
      -webkit-box-sizing: border-box;
      background:#f5f5f5;
      font-weight: bold;
      font-size: 13px;
      color: #888;
      -webkit-transition: all 200ms ease-out;
      -moz-transition: all 200ms ease-out;
      -o-transition: all 200ms ease-out;
      transition: all 200ms ease-out;
    }
    .back:hover {
      background: #eee;
    }
  
    .container {
      width: 980px;
      margin: 0 auto;
    }
    
    .page-container {
      float: left;
      width: 100%;
      margin: 0 auto 300px;
      position: relative;
    }
    
    .header {
      overflow: hidden;
      clear: both;
    }
    
    .bg {
      position: absolute;
      min-height: 100% !important;
      width: 100%;
      z-index: 0;
    }
    
    .ibg-bg {
      position: absolute;
    }
    #btns {
      text-align: center;
      margin: 50px auto;
      height: 50px;
      overflow: hidden;
      float: left;
      width: 100%;
    }
    
    
    .main {
      position: relative;
    }
    
    .shuffle-me {
      width: 25%;
      height: 150px;
      margin: 2%;
      display: block;
      position: relative;
      float: left;
      width: 26%;
      height: 209px;
    }

    .info {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0,0,0,0.35);
      padding: 20px;
      text-align: center;
      display: block;
      box-sizing: border-box;
      -webkit-box-sizing: border-box;
      -moz-box-sizing: border-box;
    }

    .info h1 {
      font-weight: bold;
      color: white;
      font-size: 20px;
      margin: 55px 0 0;
      text-transform: uppercase;
      letter-spacing: 1px;
      padding: 0;
      
    }

    .info h1 a {
     color: #fff; 
    }
    .info h2 {
      margin-top: 0;
      color: white;
      font-size: 14px;
      font-family: georgia;
      font-style: italic;
    }

    .shuffle-group {
      position: relative;
      width: 100%;
      margin-bottom: 10px;
    }

    .shuffle-group .shuffle-me {
      width: 31.9%;
      float: left;
      margin: 5px;
    }

    .shuffle-group .shuffle-me:first-child {
      width: 66%;
      float: left;
      height: 431px;
    }
    .shuffle-group .shuffle-me:first-child h1 {
      margin-top: 190px;
      font-size: 30px;
    }

    
	</style>
	<script>
	  $(document).ready(function(){
       $(".shuffle-me").shuffleImages({
         target: ".images > img"
       });
		});
		
	</script>
</head>
<body>
  <div class="wrapper">
	  <div class="main">
	    <div class="header">
        <h1>jQuery Shuffle Images</h1>
        <h2>Simplest Way to shuffle through images in a Creative Way with jQuery Shuffle Images</h2>
        
       
  	  </div>
  	   
    	<div class="container"> 
    	  
    	  <div class="shuffle-group">
    	    <div data-si-mousemove-trigger="100" class="shuffle-me">
    	      <a href="#" class="info" target="_blank"><h1>Soweto on a Bike</h1><h2>Soloing Africa Part 1</h2></a>
    	      <div class="images">
  	          <img src="images/1.jpg">
  	          <img src="images/2.jpg">
  	          <img src="images/3.jpg">
  	        </div>
  	      </div>
  	      <div class="shuffle-me">
    	      <a href="#" class="info" target="_blank"><h1>The Himalaya</h1><h2>Annapurna Base Camp</h2></a>
    	      <div class="images">
  	          <img src="images/4.jpg">
  	          <img src="images/5.jpg">
  	          <img src="images/6.jpg">
  	        </div>
  	      </div>
  	      <div class="shuffle-me">
    	      <a href="#" class="info" target="_blank"><h1>Incredible India</h1><h2>The Taj Mahal and Jaipur</h2></a>
    	      <div class="images">
  	          <img src="images/7.jpg">
  	          <img src="images/8.jpg">
  	          <img src="images/9.jpg">
  	        </div>
  	      </div>
  	    </div>
        
        <div class="shuffle-group">
          <div data-si-mousemove-trigger="100" class="shuffle-me">
    	      <a href="#" class="info" target="_blank"><h1>Incredible India</h1><h2>The Taj Mahal and Jaipur</h2></a>
    	      <div class="images">
  	          <img src="images/7.jpg">
  	          <img src="images/8.jpg">
  	          <img src="images/9.jpg">
  	        </div>
  	      </div>
    	    <div class="shuffle-me">
    	      <a href="#" class="info" target="_blank"><h1>Soweto on a Bike</h1><h2>Soloing Africa Part 1</h2></a>
    	      <div class="images">
  	          <img src="images/1.jpg">
  	          <img src="images/2.jpg">
  	          <img src="images/3.jpg">
  	        </div>
  	      </div>
  	      <div class="shuffle-me">
    	      <a href="#" class="info" target="_blank"><h1>The Himalaya</h1><h2>Annapurna Base Camp</h2></a>
    	      <div class="images">
  	          <img src="images/4.jpg">
  	          <img src="images/5.jpg">
  	          <img src="images/6.jpg">
  	        </div>
  	      </div>
  	    </div>
  	    
  	    <div class="shuffle-group">
  	      <div data-si-mousemove-trigger="100" class="shuffle-me">
    	      <a href="#" class="info" target="_blank"><h1>The Himalaya</h1><h2>Annapurna Base Camp</h2></a>
    	      <div class="images">
  	          <img src="images/6.jpg">
  	          <img src="images/4.jpg">
  	          <img src="images/5.jpg">
  	        </div>
  	      </div>
          <div class="shuffle-me">
    	      <a href="#" class="info" target="_blank"><h1>Incredible India</h1><h2>The Taj Mahal and Jaipur</h2></a>
    	      <div class="images">
  	          <img src="images/9.jpg">
  	          <img src="images/7.jpg">
  	          <img src="images/8.jpg">
  	        </div>
  	      </div>
    	    <div class="shuffle-me">
    	      <a href="#" class="info" target="_blank"><h1>Soweto on a Bike</h1><h2>Soloing Africa Part 1</h2></a>
    	      <div class="images">
  	          <img src="images/3.jpg">
  	          <img src="images/1.jpg">
  	          <img src="images/2.jpg">
  	        </div>
  	      </div>
  	    </div>
      </div>
    </div>
  </div>
</body>
</html>





JS代码(jquery.shuffle-images.min.js):

!function(e){
	var t={
	trigger:"imageMouseMove",triggerTarget:false,mouseMoveTrigger:50,hoverTrigger:200,scrollTrigger:100,target:"> img"}
;
	e.fn.shuffleImages=function(n){
	return this.each(function(){
	var r=e.extend({
}
,t,n),i=e(this),s=0,o=r.mouseMoveTrigger,u=r.hoverTrigger,a=r.scrollTrigger,f=r.triggerTarget;
	i.addClass("si-container").find(r.target).css({
	maxWidth:"100%"}
).not(":first-child").hide();
	i.find("> img:first-child").addClass("active");
	if(i.attr("data-si-mousemove-trigger"))o=i.data("si-mousemove-trigger");
	if(i.attr("data-si-hover-trigger"))u=i.data("si-hover-trigger");
	if(i.attr("data-si-scroll-trigger"))a=i.data("si-scroll-trigger");
	if(r.triggerTarget==false)f=i;
	switch(r.trigger){
	case"imageMouseMove":f.mousemove(function(e){
	var t=Math.round(Math.sqrt(Math.pow(e.clientY,2)+Math.pow(e.clientX,2)))+"px";
	if(Math.abs(parseInt(t)-s)>o){
	var n=i.find("img.active");
	if(n.next().length>0){
	n.next().addClass("active").show();
	n.removeClass("active").hide()}
else{
	i.find("img:first-child").addClass("active").show();
	n.removeClass("active").hide()}
s=parseInt(t)}
}
);
	break;
	case"imageHover":var l;
	f.mouseover(function(e){
	l=setInterval(function(){
	var e=i.find("img.active");
	if(e.next().length>0){
	e.next().addClass("active").show();
	e.removeClass("active").hide()}
else{
	i.find("img:first-child").addClass("active").show();
	e.removeClass("active").hide()}
}
,u)}
).mouseout(function(e){
	clearInterval(l)}
);
	break;
	case"documentMouseMove":e(document).mousemove(function(e){
	var t=Math.round(Math.sqrt(Math.pow(e.clientY,2)+Math.pow(e.clientX,2)))+"px";
	if(Math.abs(parseInt(t)-s)>o){
	var n=i.find("img.active");
	if(n.next().length>0){
	n.next().addClass("active").show();
	n.removeClass("active").hide()}
else{
	i.find("img:first-child").addClass("active").show();
	n.removeClass("active").hide()}
s=parseInt(t)}
}
);
	break;
	case"documentScroll":e(document).on("touchmove mousewheel DOMMouseScroll",function(t,n){
	var r=e(document).scrollTop();
	if(Math.abs(parseInt(r)-s)>a){
	var o=i.find("img.active");
	if(o.next().length>0){
	o.next().addClass("active").show();
	o.removeClass("active").hide()}
else{
	i.find("img:first-child").addClass("active").show();
	o.removeClass("active").hide()}
s=parseInt(e(document).scrollTop())}
}
);
	break;
	default:}
}
)}
}
(window.jQuery)
附件:下载该文件资源,减少时间成本(增值服务)
留言
该资源可下载
File Source
.rar
904.55 KB
Html Js 图片切换触摸1
最新结算
jquery虚拟键盘中文打字效果js代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
jquery虚拟键盘中文打字效果js代码
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
HTML5实现CSS滤镜图片切换特效代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
jQuery头像裁剪插件cropbox js代码
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
jQuery头像裁剪插件cropbox js代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
jQuery+css3实现信封效果
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
我们力求给您提供有用的文章,再此基础上,会附加营收资源,不做任何广告,让平台可以更好发展 若您发现您的权利被侵害,或使用了您的版权,请发邮件联系 sunlifel@foxmail.com ggbig觉得 : 不提供源码的文章不是好文章
合作伙伴
联系我们
  • QQ:21499807
  • 邮箱:sunlifel@foxmail.com
  • QQ扫一扫加QQ
    QQ扫一扫
Copyright 2023-2024 ggbig.com·皖ICP备2023004211号-1
打赏文章