Javascript可见性功能与转换

时间:2017-04-15 17:38:14

标签: javascript html css

我为div创建了一个JavaScript on-click函数,以隐藏或使用可见性显示它。如何添加到此功能的转换,以便我的div不会突然出现?

    function about()
{
    var elem = document.getElementById('about');
    elem.style.visibility = "visible";
}

1 个答案:

答案 0 :(得分:0)

解决方案1(CSS3 + JS):

的CSS:

print_r($result_json)

和js:

{
  "title":          "module_apps_best_selling",
  "type":       "apps",
  "vendor":         "",
  "is_free":   "Yes",
  "website_to_sell" : "",
  "version":            1.0,
  "req_core_version":   3.0,
  "license":            "GPL 2",
  "tag":                "apps, module, products, listing, best selling",
  "install":            "includes/Apps/",
  "module_directory":   "ProductsListing",
  "apps_name":          "\BestSelling",
  "type_module":        "fixe",
  "dependance":         "",

 "description":        "This module allow you to insert a new page called Best Selling inside the catalog. It create also in the template directory a new directory where you can manage and create template.",
  "image":              "ModuleInfosJson/apps_best_selling.png",

  "authors": [
    {
      "name":           "",
      "company":        "",
      "email":          "",
      "website":        "",
      "Community":    ""
    }
  ]
}

解决方案2(仅限JS):

#about{ transition:all ease 2s; opacity:0;}

注意:您只能切换可见性(开/关)。不透明度定义了你可以“看到低谷”的数量,它从0(无可见)到1(全部可见)......