CINXE.COM
JD.com Case Study | Kubernetes
<!DOCTYPE html> <html id="caseStudies" lang="zh-cn" class=""> <head> <meta name="robots" content="noindex, nofollow"> <link rel="alternate" hreflang="en" href="https://kubernetes.io/case-studies/jd-com/"> <link rel="alternate" hreflang="bn" href="https://kubernetes.io/bn/case-studies/jd-com/"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="generator" content="Hugo 0.121.2"> <link rel="shortcut icon" type="image/png" href="/images/kubernetes.png" /><link rel="icon" type="image/png" sizes="64x64" href="/icons/favicon-64.png" /><link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32.png" /><link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16.png" /><link rel="apple-touch-icon-256x256" href="/icons/apple-touch-icon-256x256.png" /><link rel="apple-touch-icon-196x196" href="/icons/apple-touch-icon-196x196.png" /><link rel="apple-touch-icon-192x192" href="/icons/apple-touch-icon-192x192.png" /><link rel="apple-touch-icon-180x180" href="/icons/apple-touch-icon-180x180.png" /><link rel="apple-touch-icon-167x167" href="/icons/apple-touch-icon-167x167.png" /><link rel="apple-touch-icon-160x160" href="/icons/apple-touch-icon-160x160.png" /><link rel="apple-touch-icon-152x152" href="/icons/apple-touch-icon-152x152.png" /><link rel="apple-touch-icon-120x120" href="/icons/apple-touch-icon-120x120.png" /><link rel="apple-touch-icon-76x76" href="/icons/apple-touch-icon-76x76.png" /><link rel="icon" type="image/png" href="/icons/icon-128x128.png" sizes=128x128><meta name="theme-color" content="#326de6" /> <title>JD.com Case Study | Kubernetes</title><meta property="og:title" content="JD.com Case Study" /> <meta property="og:description" content="Challenge With more than 300 million active users and total 2017 revenue of more than $55 billion, JD.com is China's largest retailer, and its operations are the epitome of hyperscale. For example, there are more than a trillion images in JD.com's product databases—with 100 million being added daily—and this enormous amount of data needs to be instantly accessible. In 2014, JD.com moved its applications to containers running on bare metal machines using OpenStack and Docker to "" /> <meta property="og:type" content="article" /> <meta property="og:url" content="https://kubernetes.io/zh-cn/case-studies/jd-com/" /><meta property="og:image" content="https://kubernetes.io/zh-cn/case-studies/jd-com/jd-com_featured_logo.png" /><meta property="article:section" content="case-studies" /> <meta property="article:modified_time" content="2022-06-10T20:25:27+08:00" /> <meta itemprop="name" content="JD.com Case Study"> <meta itemprop="description" content="Challenge With more than 300 million active users and total 2017 revenue of more than $55 billion, JD.com is China's largest retailer, and its operations are the epitome of hyperscale. For example, there are more than a trillion images in JD.com's product databases—with 100 million being added daily—and this enormous amount of data needs to be instantly accessible. In 2014, JD.com moved its applications to containers running on bare metal machines using OpenStack and Docker to ""> <meta itemprop="dateModified" content="2022-06-10T20:25:27+08:00" /> <meta itemprop="wordCount" content="1343"><meta itemprop="image" content="https://kubernetes.io/zh-cn/case-studies/jd-com/jd-com_featured_logo.png" /> <meta itemprop="keywords" content="" /><meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:image" content="https://kubernetes.io/zh-cn/case-studies/jd-com/jd-com_featured_logo.png" /><meta name="twitter:title" content="JD.com Case Study"/> <meta name="twitter:description" content="Challenge With more than 300 million active users and total 2017 revenue of more than $55 billion, JD.com is China's largest retailer, and its operations are the epitome of hyperscale. For example, there are more than a trillion images in JD.com's product databases—with 100 million being added daily—and this enormous amount of data needs to be instantly accessible. In 2014, JD.com moved its applications to containers running on bare metal machines using OpenStack and Docker to ""/> <link href="/scss/main.css" rel="stylesheet"> <link rel="manifest" href="/manifest.webmanifest"> <script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Organization", "url": "https://kubernetes.io", "logo": "https://kubernetes.io/images/favicon.png", } </script> <meta name="theme-color" content="#326ce5"> <style> .gutter { background-color: #eee; background-repeat: no-repeat; background-position: 50%; } .gutter.gutter-horizontal { background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg=='); cursor: col-resize; } #sidebarnav, #maindoc { max-width: 100%; } #maindoc { overflow-wrap: break-word; } @media (max-width: 768px) { #sidebarnav { padding-left: 15px; padding-right: 15px; } } </style> <link rel="stylesheet" href="/scss/_case-studies.f79eaadb37c5ce0b99b43075c83703b9e8d6e0b058a516ceb4cc46f9c1d98741.css" integrity="sha256-956q2zfFzguZtDB1yDcDuejW4LBYpRbOtMxG+cHZh0E="> <link rel="stylesheet" href="/css/new-case-studies.css"> <meta name="description" content="Challenge With more than 300 million active users and total 2017 revenue of more than $55 billion, JD.com is China's largest retailer, and its operations are the epitome of hyperscale. For example, there are more than a trillion images in JD.com's product databases—with 100 million being added daily—and this enormous amount of data needs to be instantly accessible. In 2014, JD.com moved its applications to containers running on bare metal machines using OpenStack and Docker to ""> <meta property="og:description" content="Challenge With more than 300 million active users and total 2017 revenue of more than $55 billion, JD.com is China's largest retailer, and its operations are the epitome of hyperscale. For example, there are more than a trillion images in JD.com's product databases—with 100 million being added daily—and this enormous amount of data needs to be instantly accessible. In 2014, JD.com moved its applications to containers running on bare metal machines using OpenStack and Docker to ""> <meta name="twitter:description" content="Challenge With more than 300 million active users and total 2017 revenue of more than $55 billion, JD.com is China's largest retailer, and its operations are the epitome of hyperscale. For example, there are more than a trillion images in JD.com's product databases—with 100 million being added daily—and this enormous amount of data needs to be instantly accessible. In 2014, JD.com moved its applications to containers running on bare metal machines using OpenStack and Docker to ""> <meta property="og:url" content="https://kubernetes.io/zh-cn/case-studies/jd-com/"> <meta property="og:title" content="JD.com Case Study"> <meta name="twitter:title" content="JD.com Case Study"> <meta name="twitter:image" content="https://kubernetes.io/images/favicon.png" /> <meta name="twitter:image:alt" content="Kubernetes"> <meta property="og:image" content="/images/kubernetes-horizontal-color.png"> <meta property="og:type" content="article"> <script src="/js/jquery-3.6.0.min.js" intregrity="sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK" crossorigin="anonymous"></script> <script src="/js/split-1.6.0.js" intregrity="sha384-0blL3GqHy6+9fw0cyY2Aoiwg4onHAtslAs4OkqZY7UQBrR65/K4gI+hxLdWDrjpz"></script> <script defer src="/js/dismiss_banner.js"></script> </head> <body> <nav class="js-navbar-scroll navbar navbar-expand navbar-dark flex-column flex-md-row td-navbar" data-auto-burger="primary"> <a class="navbar-brand img-fluid" href="/zh-cn/"></a> <div class="td-navbar-nav-scroll ml-md-auto" id="main_navbar"> <ul class="navbar-nav mt-2 mt-lg-0"> <li class="nav-item mr-2 mb-lg-0"> <a class="nav-link" href="/zh-cn/docs/" >文档</a> </li> <li class="nav-item mr-2 mb-lg-0"> <a class="nav-link" href="/zh-cn/blog/" >Kubernetes 博客</a> </li> <li class="nav-item mr-2 mb-lg-0"> <a class="nav-link" href="/zh-cn/training/" >培训</a> </li> <li class="nav-item mr-2 mb-lg-0"> <a class="nav-link" href="/zh-cn/partners/" >合作伙伴</a> </li> <li class="nav-item mr-2 mb-lg-0"> <a class="nav-link" href="/zh-cn/community/" >社区</a> </li> <li class="nav-item mr-2 mb-lg-0"> <a class="nav-link active" href="/zh-cn/case-studies/" >案例分析</a> </li> <li class="nav-item mr-n3 mr-lg-0 dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 版本列表 </a> <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink"> <a class="dropdown-item" href="/zh-cn/releases">发布信息</a> <a class="dropdown-item" href="https://kubernetes.io/zh-cn/case-studies/jd-com/">v1.31</a> <a class="dropdown-item" href="https://v1-30.docs.kubernetes.io/zh-cn/case-studies/jd-com/">v1.30</a> <a class="dropdown-item" href="https://v1-29.docs.kubernetes.io/zh-cn/case-studies/jd-com/">v1.29</a> <a class="dropdown-item" href="https://v1-28.docs.kubernetes.io/zh-cn/case-studies/jd-com/">v1.28</a> <a class="dropdown-item" href="https://v1-27.docs.kubernetes.io/zh-cn/case-studies/jd-com/">v1.27</a> </div> </li> <li class="nav-item mr-n4 mr-lg-0 dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 中文 (Chinese) </a> <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink"> <a class="dropdown-item" href="/case-studies/jd-com/">English</a> <a class="dropdown-item" href="/bn/case-studies/jd-com/">বাংলা (Bengali)</a> </div> </li> <li class="search-item nav-item mr-n4 mr-lg-0"> <div class="search-bar"> <i class="search-icon fas fa-search"></i> <input type="search" name="q" data-search-page="/zh-cn/search/" class="search-input td-search-input" placeholder="搜索" aria-label="搜索" autocomplete="off" > </div> </li> </ul> </div> <button id="hamburger" onclick="kub.toggleMenu()" data-auto-burger-exclude><div></div></button> </nav> <section id="deprecation-warning"> <div class="content deprecation-warning pageinfo"> <h3> 你正在查看的文档所针对的是 Kubernetes 版本: v1.30 </h3> <p> Kubernetes v1.30 版本的文档已不再维护。你现在看到的版本来自于一份静态的快照。如需查阅最新文档,请点击 <a href="https://kubernetes.io/docs/home/">最新版本。</a> </p> </div> </section> <div data-pagefind-body> <div class="banner " style="background-image: url(/images/case-studies/jdcom/banner1.jpg);"> <h1> <span class="heading">案例分析:</span><img class="heading-logo" src="/images/jdcom_logo.png" /><span class="subheading">JD.com: How JD.com Pioneered Kubernetes for E-Commerce at Hyperscale </span> </h1> </div> <div class="details"> <span class="item">Company <strong>JD.com</strong></span> <span class="item">Location <strong>Beijing, China</strong></span> <span class="item">Industry <strong>eCommerce</strong></span> </div> <div class="content"> <h2>Challenge</h2> <p>With more than 300 million active users and total 2017 revenue of more than $55 billion, <a href="https://corporate.JD.com/home">JD.com</a> is China's largest retailer, and its operations are the epitome of hyperscale. For example, there are more than a trillion images in JD.com's product databases—with 100 million being added daily—and this enormous amount of data needs to be instantly accessible. In 2014, JD.com moved its applications to containers running on bare metal machines using OpenStack and Docker to "speed up the delivery of our computing resources and make the operations much simpler," says Haifeng Liu, JD.com's Chief Architect. But by the end of 2015, with tens of thousands of nodes running in multiple data centers, "we encountered a lot of problems because our platform was not strong enough, and we suffered from bottlenecks and scalability issues," says Liu. "We needed infrastructure for the next five years of development, now."</p> <h2>Solution</h2> <p>JD.com turned to Kubernetes to accommodate its clusters. At the beginning of 2016, the company began to transition from OpenStack to Kubernetes, and today, JD.com runs the world's largest Kubernetes cluster. "Kubernetes has provided a strong foundation on top of which we have customized the solution to suit our needs as China's largest retailer."</p> <h2>Impact</h2> <p>"We have greater data center efficiency, better managed resources, and smarter deployment with the Kubernetes platform," says Liu. Deployment time went from several hours to tens of seconds. Efficiency has improved by 20-30%, measured in IT costs. With the further optimizations the team is working on, Liu believes there is the potential to save hundreds of millions of dollars a year. But perhaps the best indication of success was the annual Singles Day shopping event, which ran on the Kubernetes platform for the first time in 2018. Over 11 days, transaction volume on JD.com was $23 billion, and "our e-commerce platforms did great," says Liu. "Infrastructure led the way to prep for 11.11. We took the approach of predicting volume, emulating the behavior of customers to prepare beforehand, and drilled for malfunctions. Because of Kubernetes's scalability, we were able to handle an extremely high level of demand."</p> <div class="quote banner"> <div class="quote-text"> "Kubernetes helped us reduce the complexity of operations to make distributed systems stable and scalable. Most importantly, we can leverage Kubernetes for scheduling resources to reduce hardware costs. That's the big win." <span class="quote-author">— HAIFENG LIU, CHIEF ARCHITECT, JD.com</span> </div> </div> <div class="lead"> With more than 300 million active users and $55.7 billion in annual revenues last year, JD.com is China's largest retailer, and its operations are the epitome of hyperscale. </div> <p>For example, there are more than a trillion images in JD.com's product databases for customers, with 100 million being added daily. And this enormous amount of data needs to be instantly accessible to enable a smooth online customer experience.</p> <p>In 2014, JD.com moved its applications to containers running on bare metal machines using OpenStack and Docker to "speed up the delivery of our computing resources and make the operations much simpler," says Haifeng Liu, JD.com's Chief Architect. But by the end of 2015, with hundreds of thousands of nodes in multiple data centers, "we encountered a lot of problems because our platform was not strong enough, and we suffered from bottlenecks and scalability issues," Liu adds. "We needed infrastructure for the next five years of development, now."</p> <p>After considering a number of orchestration technologies, JD.com decided to adopt Kubernetes to accommodate its ever-growing clusters. "The main reason is because Kubernetes can give us more efficient, scalable and much simpler application deployments, plus we can leverage it to do flexible platform scheduling," says Liu.</p> <div class="quote banner " style="background-image: url(/images/case-studies/jdcom/banner3.jpg);"> <div class="quote-text"> "We customized Kubernetes and built a modern system on top of it. This entire ecosystem of Kubernetes plus our own optimizations have helped us save costs and time." <span class="quote-author">— HAIFENG LIU, CHIEF ARCHITECT, JD.com</span> </div> </div> <p>The fact that Kubernetes is based on Google's Borg also gave the company confidence. The team liked that Kubernetes has a clear and simple architecture, and that it's developed mostly in Go, which is a popular language within JD.com. Though he felt that at the time Kubernetes "was not mature enough," Liu says, "we adopted it anyway."</p> <p>The team spent a year developing the new container engine platform based on Kubernetes, and at the end of 2016, began promoting it within the company. "We wanted the cluster to be the default way for creating services, so scalability is easier," says Liu. "We talked to developers, interest grew, and we solved problems together." Some of these problems included networking performance and etcd scalability. "But during the past two years, Kubernetes has become more mature and very stable," he adds.</p> <p>Today, the company runs the world's largest Kubernetes cluster. "We customized Kubernetes and built a modern system on top of it," says Liu. "This entire ecosystem of Kubernetes plus our own optimizations have helped us save costs and time. We have greater data center efficiency, better managed resources, and smarter deployment with the Kubernetes platform."</p> <div class="quote banner " style="background-image: url(/images/case-studies/jdcom/banner4.jpg);"> <div class="quote-text"> "My advice is first you need to combine this technology with your own businesses, and the second is you need clear goals. You cannot just use the technology because others are using it. You need to consider your own objectives." <span class="quote-author">— HAIFENG LIU, CHIEF ARCHITECT, JD.com</span> </div> </div> <p>The results are clear: Deployment time went from several hours to tens of seconds. Efficiency has improved by 20-30%, measured in IT costs. But perhaps the best indication of success was the annual <a href="https://JD.comcorporateblog.com/shoppers-snap-up-quality-and-imported-products-on-JD.com-com-for-record-breaking-singles-day-festival/">Singles Day</a> shopping event, which ran on the Kubernetes platform for the first time in 2018. Over 11 days, transaction volume on JD.com was $23 billion, and "our e-commerce platforms did great," says Liu. "Infrastructure led the way to prep for 11.11. We took the approach of predicting volume, emulating the behavior of customers to prepare beforehand, and drilled for malfunctions. Because of Kubernetes's scalability, we were able to handle an extremely high level of demand."</p> <p>JD.com is now in its second stage with Kubernetes: The platform is already stable, scalable, and flexible, so the focus is on how to run things much more efficiently to further reduce costs. With the optimizations the team is working on with resource management, Liu believes there is the potential to save hundreds of millions of dollars a year.</p> <p>"We run Kubernetes and container clusters on roughly tens of thousands of physical bare metal nodes," he says. "Using Kubernetes and leveraging our own machine learning pipeline to predict how many resources we need for each application we use, and our own intelligent scaling algorithm, we can improve our resource usage. If we boost the resource usage, for example, by several percent, that means we can reduce huge hardware costs. Then we don't need that many servers to get that same amount of workload. That can save us a lot of resources."</p> <div class="quote banner"> <div class="quote-text"> "We can share our successful experience with the community, and we also receive good feedback from others. So it's mutually beneficial." <span class="quote-author">— HAIFENG LIU, CHIEF ARCHITECT, JD.com</span> </div> </div> <p>JD.com, which won CNCF's 2018 End User Award, is also using <a href="https://helm.sh/">Helm</a>, <a href="https://github.com/containernetworking">CNI</a>, <a href="https://goharbor.io/">Harbor</a>, and <a href="https://vitess.io/">Vitess</a> on its platform. JD.com developers have made considerable contributions to Vitess, the CNCF project for scalable MySQL cluster management, and the company hopes to donate its own project to CNCF in the near future. Community participation is a priority for JD.com. "We have a good partnership with this community," says Liu. "We can share our successful experience with the community, and we also receive good feedback from others. So it's mutually beneficial."</p> <p>To that end, Liu offers this advice for other companies considering adopting cloud native technology. "First you need to combine this technology with your own businesses, and the second is you need clear goals," he says. "You cannot just use the technology because others are using it. You need to consider your own objectives."</p> <p>For JD.com's objectives, these cloud native technologies have been an ideal fit with the company's own homegrown innovation. "Kubernetes helped us reduce the complexity of operations to make distributed systems stable and scalable," says Liu. "Most importantly, we can leverage Kubernetes for scheduling resources to reduce hardware costs. That's the big win."</p> </div> </div> <footer class="d-print-none"> <div class="footer__links"> <nav> <a class="text-white" href="/zh-cn/docs/home/">文档</a> <a class="text-white" href="/zh-cn/blog/">博客</a> <a class="text-white" href="/zh-cn/training/">培训</a> <a class="text-white" href="/zh-cn/partners/">合作伙伴</a> <a class="text-white" href="/zh-cn/community/">社区</a> <a class="text-white" href="/zh-cn/case-studies/">案例分析</a> </nav> </div> <div class="container-fluid"> <div class="row"> <div class="col-6 col-sm-2 text-xs-center order-sm-2"> <ul class="list-inline mb-0"> <li class="list-inline-item mx-2 h3" data-toggle="tooltip" data-placement="top" title="User mailing list" aria-label="User mailing list"> <a class="text-white" target="_blank" href="https://discuss.kubernetes.io"> <i class="fa fa-envelope"></i> </a> </li> <li class="list-inline-item mx-2 h3" data-toggle="tooltip" data-placement="top" title="X(Twitter)" aria-label="X(Twitter)"> <a class="text-white" target="_blank" href="https://twitter.com/kubernetesio"> <i class="fab fa-x-twitter"></i> </a> </li> <li class="list-inline-item mx-2 h3" data-toggle="tooltip" data-placement="top" title="Calendar" aria-label="Calendar"> <a class="text-white" target="_blank" href="https://calendar.google.com/calendar/embed?src=calendar%40kubernetes.io"> <i class="fas fa-calendar-alt"></i> </a> </li> <li class="list-inline-item mx-2 h3" data-toggle="tooltip" data-placement="top" title="Youtube" aria-label="Youtube"> <a class="text-white" target="_blank" href="https://youtube.com/kubernetescommunity"> <i class="fab fa-youtube"></i> </a> </li> </ul> </div> <div class="col-6 col-sm-2 text-right text-xs-center order-sm-3"> <ul class="list-inline mb-0"> <li class="list-inline-item mx-2 h3" data-toggle="tooltip" data-placement="top" title="GitHub" aria-label="GitHub"> <a class="text-white" target="_blank" href="https://github.com/kubernetes/kubernetes"> <i class="fab fa-github"></i> </a> </li> <li class="list-inline-item mx-2 h3" data-toggle="tooltip" data-placement="top" title="Slack" aria-label="Slack"> <a class="text-white" target="_blank" href="https://slack.k8s.io"> <i class="fab fa-slack"></i> </a> </li> <li class="list-inline-item mx-2 h3" data-toggle="tooltip" data-placement="top" title="Contribute" aria-label="Contribute"> <a class="text-white" target="_blank" href="https://git.k8s.io/community/contributors/guide"> <i class="fas fa-edit"></i> </a> </li> <li class="list-inline-item mx-2 h3" data-toggle="tooltip" data-placement="top" title="Stack Overflow" aria-label="Stack Overflow"> <a class="text-white" target="_blank" href="https://stackoverflow.com/questions/tagged/kubernetes"> <i class="fab fa-stack-overflow"></i> </a> </li> </ul> </div> <div class="col-12 col-sm-8 text-center order-sm-2"> <small class="text-white">© 2024 The Kubernetes 作者 | 文档发布基于 <a href="https://git.k8s.io/website/LICENSE" class="light-text">CC BY 4.0</a> 授权许可</small> <br/> <small class="text-white">Copyright © 2024 Linux 基金会®。保留所有权利。Linux 基金会已注册并使用商标。如需了解 Linux 基金会的商标列表,请访问<a href="https://www.linuxfoundation.org/trademark-usage" class="light-text">商标使用页面</a></small> <br/> <small class="text-white">ICP 许可: 京ICP备17074266号-3</small> </div> </div> </div> </footer> <script src="/js/jquery-3.6.0.min.js" integrity="sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK" crossorigin="anonymous"></script> <script src="/js/popper-1.16.1.min.js" intregrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script> <script src="/js/bootstrap-4.6.1.min.js" integrity="sha384-VHvPCCyXqtD5DqJeNxl2dtTyhF78xXNXdkwX1CZeRusQfRKp+tA7hAShOK/B/fQ2" crossorigin="anonymous"></script> <script src="/js/script.js"></script> <script src="/js/main.min.b8b5957f4ba9b582bc3696c8cbed20dde33f789d0fe3255f10fdc7adecf38b7e.js" integrity="sha256-uLWVf0uptYK8NpbIy+0g3eM/eJ0P4yVfEP3Hrezzi34=" crossorigin="anonymous"></script> <script> let splitInstance = null; function enableSplitter(mediaQuery) { if (mediaQuery.matches) { if (!splitInstance) { splitInstance = Split(["#sidebarnav", "#maindoc"], { sizes: [20, 80], minSize: 100, }); } } else { if (splitInstance) { splitInstance.destroy(); splitInstance = null; } } } const screenWidthMediaQuery = window.matchMedia("(min-width: 768px)"); const eleNav = document.getElementById("sidebarnav"); if (eleNav !== null) { enableSplitter(screenWidthMediaQuery); screenWidthMediaQuery.addListener(enableSplitter); } </script> </body> </html>