超链接,图片等颜色渐变(通过hover进行控制)

1.

超链接的颜色渐变(以下有三种方式)

      

      <style>
       .a{
         color:red;
       }
      
       .b{
         color:green;
       }
      
       .c{
         color:white;
       }
      
    </style>
   
  </head>
   
    <script type="text/javascript" src="JS/jquery.js"></script>
    <script type="text/javascript" src="JS/interface.js"></script>
    <script type="text/javascript"><%--
         $(document).ready(function(){
             $("a").each(function(){
                  $(this).css("color","#eee")
             }).hover(function(){
                  $(this).animate({style:"color:red"})
             },function(){
                  $(this).animate({style:"color:#eee"})
             })
           
         });
   
   
      $(document).ready(function(){
        
          $("a").each(function(){
               $(this).css("color","white");
          }).hover(function(){
               $(this).css("color","red");
          },function(){
               $(this).css("color","green");
          });
     
      });
    
 
     
      $(document).ready(function(){
              
         $("a").hover(function(){
             $(this).addClass("a");
         },function(){
             $(this).removeClass("a"); 
         });     
      
      });
   
    </script>

 

2.图片的颜色渐变

 

<body style="background:#000;"> 
  <img src="http://www.cssrain.cn/skins/tim/logo-jq.gif" />             <br/><br/> 
  <img src="http://www.cssrain.cn/demo/JQuery+API/logo-json.gif" />    <br/><br/> 
     <img src="http://www.baidu.com/img/logo.gif" />                   <br/><br/> 
     <img src="http://www.google.cn/intl/zh-CN/images/logo_cn.gif" />     <br/>     
      
  
        <script>
        $('img').each(function(){$(this).css("opacity",".6")})
        .hover(function(){$(this).animate({
         opacity:"1"
         })
         },function(){
         $(this).animate({
          opacity:".6"
         })
         
       });
        

        </script>

</body>

 

说明:

  css(name, value) :$(this).css("opacity",".6")  在所有匹配的元素中,设置一个样式属性的值。 

  animated : $(this).animate({opacity:"1"})  用于创建自定义动画的函数.

 

 

3.循环显示文字或者图片

 

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值