折叠时jQuery悬停幻灯片子菜单不起作用

时间:2017-10-13 08:09:35

标签: jquery asp.net-mvc slidedown mouseenter mouseleave

我正在尝试创建一个导航菜单,该菜单在mouseenter / mouseleave上实现slideDown / slideUp功能以显示子菜单。我只希望在大屏幕水平扩展菜单时运行slidedown / slideup功能。当显示汉堡菜单(小屏幕)时,我只希望用户必须单击菜单项才能显示子菜单。我设法让滑动功能按预期工作,但是当显示汉堡包菜单时,我无法点击菜单项来显示子菜单。有什么想法吗?

jQuery的:

<body>
<div class="navbar navbar-inverse navbar-fixed-top">
    <div class="container">
        <div class="navbar-header" id="navBarHeader">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse" id="navBarCollapseButton">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
        </div>
        <div class="navbar-collapse collapse" id="navBar">
            <ul class="nav navbar-nav">
                <li class="menu-item">@Html.ActionLink("Home", "Index", "Home")</li>
                <li class="submenu">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Main1</a>
                    <ul class="dropdown-menu" role="menu">
                        <li>@Html.ActionLink("Item1", "About", "Home")</li>
                        <li>@Html.ActionLink("Item2", "About", "Home")</li>
                    </ul>
                </li>
                <li class="submenu">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Main2</a>
                    <ul class="dropdown-menu" role="menu">
                        <li class="submenu">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">SubMain1</a>
                            <ul  role="menu">
                                <li>@Html.ActionLink("Item3", "Contact", "Home")</li>
                                <li>@Html.ActionLink("Item4", "Contact", "Home")</li>
                            </ul>
                        </li>
                        <li>@Html.ActionLink("SubMain2", "Index", "Home")</li>
                    </ul>
                </li>
                <li></li>
            </ul>
        </div>
    </div>
</div>
<div class="container body-content">
    @RenderBody()
    <hr />
    <footer>
        <p>&copy; @DateTime.Now.Year - My ASP.NET Application</p>
        @Html.ActionLink("Home","Index", "Home")
    </footer>
</div>
@RenderSection("scripts", required: false)

HTML:

func getContext(){

        let container: NSPersistentContainer? = (UIApplication.shared.delegate as? AppDelegate)?.persistentContainer

        let delegate = UIApplication.shared.delegate as? AppDelegate

        if let context = container?.viewContext{

        let request = NSFetchRequest<Mydata>(entityName: "Mydata")
        do {
            let searchResults = try context.fetch(request)

            let person1 = searchResults[0]

           if person1.value(forKey: "iD") as! String != self.myiddddddd {

           let person = NSEntityDescription.insertNewObject(forEntityName: "Mydata",


            person.setValue(nameFunc, forKey: "name")

            person.setValue(imageArray, forKeyPath: "profimg")
            person.setValue(postImageArray, forKeyPath: "mid_img")

            person.setValue(myUId, forKey: "iD")

            do{

              try (context.save())
                DispatchQueue.main.async(execute: { () -> Void in

                                      self.myTable.reloadData()
                                   })

            }
            catch
            {
                print(error)
            }
            catch {

            }
            }


        } catch {
            print("Error with request: \(error)")
        }

        }

        }

更新:在过去的几周里,我们已经定期回到这里,但仍然让我难过。请帮忙!

0 个答案:

没有答案