zoukankan      html  css  js  c++  java
  • 渐隐渐现fade js

    function fadeIn(el){
    el.style.opacity = 0;
    el.style.filter = 'alpha(opacity = 0)';
    el.style.display = 'block';
    var n = 0;
    function fadeShow(){
    if (n < 1){
    n += 0.1;
    el.style.opacity = n;
    el.style.filter = 'alpha(opacity = '+n*100+')';
    var setTimeId = setTimeout(fadeShow, 50);
    }else{
    el.style.opacity = 1;
    el.style.filter = 'alpha(opacity = 100)';
    clearTimeout(setTimeId);
    }
    }
    fadeShow();
    }
    function fadeOut(el){
    el.style.opacity = 1;
    el.style.filter = 'alpha(opacity = 100)';
    var n = 1;
    function fadeHide(){
    if (n > 0){
    n -= 0.1;
    el.style.opacity = n;
    el.style.filter = 'alpha(opacity = '+n*100+')';
    var setTimeId = setTimeout(fadeHide, 50);
    }else{
    el.style.opacity = 0;
    el.style.filter = 'alpha(opacity = 0)';
    clearTimeout(setTimeId);
    el.style.display = 'none';
    }
    }
    fadeHide();
    }
  • 相关阅读:
    NSString
    IOS
    IOS
    UITextView
    UIButton
    IOS 视频缩略图的生成
    IOS CALayer的阴影属性
    IOS 创建渐变图层
    IOS 截取图片 部分 并生成新图片
    [看远、看透、看淡]
  • 原文地址:https://www.cnblogs.com/bianyuan/p/2356660.html
Copyright © 2011-2022 走看看