In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "html5 how to achieve menu bar and dynamic operation of tab item effect". In daily operation, I believe many people have doubts about how to achieve menu bar and dynamic operation of tab item effect in html5. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubt of "how to achieve menu bar and dynamic operation of tab item effect by html5". Next, please follow the editor to study!
Html code: (I omitted the introduction of js and css files on the page, and pay attention to the order in which jQuery is introduced.)
Default deployment option an option b Jump solution Mobile Module Background template e-commerce platform product c Big data closes the current shutdown of all
Js Code:
Layui.use ('element', function () {var $= layui.jquery; var element = layui.element / / Tab switching function, switching event listening, etc. You need to rely on element module / / trigger event var active = {/ / bind several events to active here. Later, you can call these events via active: function (url,id,name) {/ / add a Tab entry to pass three parameters Corresponding to the title, the address of the tab page, and a specified id Is the attribute value of data-id in the tag / / the parameters passed in the method about tabAdd can be found in the basic method section element.tabAdd ('demo', {title: name, content:''in the development document of layui. Id: id / / defined id}) CustomRightClick (id) / / bind to tab right-click the event FrameWH (); / / calculate the size of the ifram layer}, tabChange: function (id) {/ / switch to the specified Tab item element.tabChange ('demo', id) / / according to the id passed in, the specified tab entry}, tabDelete: function (id) {element.tabDelete ("demo", id) / / delete}, tabDeleteAll: function (ids) {/ / delete all $.each (ids, function (iMagin item) {element.tabDelete ("demo", item) / / ids is an array containing multiple id. Call the tabDelete method to delete})} / / the click event $('.site-demo-active') .on (' click', function () {var dataid = $(this)) is triggered when you click on the tag with the site-demo-active attribute, that is, the content in the left menu bar. / / the number of li with lay-id attribute under the .layui-tab-title attribute on the right will be judged, that is, the number of tab items that have been opened if ($(".layui-tab-title li [lay-id]") .length
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.