jquery-hover

How to get the position of an specific li in a ul tag?

余生颓废 提交于 2019-12-02 07:29:20
I want to get number of one li that I hover on with jQuery . this is my code : <ul> <li></li> <li></li> <li></li> /* I want hover on this element */ <li></li> <li></li> </ul> I want when hover on certain element in top code get number of all lies .... for example in top code I want get 3 (This means that this third element) You can use this: var number = $(this).index() + 1; Demo here The .index() starts at 0 so I added +1 because you wanted to start counting from 1. 来源: https://stackoverflow.com/questions/18555857/how-to-get-the-position-of-an-specific-li-in-a-ul-tag

How to allow for a default submenu on a jQuery hover menu

好久不见. 提交于 2019-12-01 11:41:57
This started from a related question . After getting a brilliant answer I ran into an unforeseen gap in functionality: how can I show a menu open by default? More specifically if a user lands on a page that exists in my sub-nav I want to have that sub-nav open with the current page highlighted. If they use the menu to browse around it will change accordingly, but always go back to the default state if they don't make a selection. The code I'm basing this off can be found in this jsfiddle . The menu structure is like: <div id="mnav"> <ul id="buttons"> <li class="one"><a href="#">Main 1</a></li>

How to allow for a default submenu on a jQuery hover menu

纵然是瞬间 提交于 2019-12-01 11:21:59
问题 This started from a related question. After getting a brilliant answer I ran into an unforeseen gap in functionality: how can I show a menu open by default? More specifically if a user lands on a page that exists in my sub-nav I want to have that sub-nav open with the current page highlighted. If they use the menu to browse around it will change accordingly, but always go back to the default state if they don't make a selection. The code I'm basing this off can be found in this jsfiddle. The

Making an element visible by hovering another element (without :hover-property)

我的梦境 提交于 2019-12-01 01:38:05
Okay, here's the problem: i have these three DIVs: <div id="gestaltung_cd"></div> <div id="gestaltung_illu"></div> <div id="gestaltung_klassisch"></div> …and these three DIVs – which are invisible (display:none;)– on a completely different position on the page: <div id="mainhexa1"></div> <div id="mainhexa2"></div> <div id="mainhexa3"></div> what i want to do is: if i hover "gestaltung_cd" i want to make "mainhexa1" visible and if i hover "gestaltung_illu" i want to make "mainhexa2" visbile and so on… as you can see, the three invisible DIVs are no child-elements of the first three ones... so "

Toggle div's on hover

北城余情 提交于 2019-12-01 01:13:20
I have a test UL list that goes like this: <ul> <li id="firstdiv">First div</li> <li id="seconddiv">Second div</li> <li id="thirddiv">Third div</li> .... </ul> And, bellow that i have related div's, aka: <div id="firstdiv">Content Here</div> <div id="seconddiv">Content Here</div> <div id="thirddiv">Content Here</div> I was wondering how could i make each div only shows when its LI item is hovered, maybe with some fadein effect. I tried with some other answers from here, but no luck :\ As I've mentioned, it is important that your id s are unique. So you need to find another way to reference

How can I keep my sub-menu open in jQuery hover menu?

▼魔方 西西 提交于 2019-11-29 15:13:07
I just started coding in jQuery last week and need some help figuring out how to make a menu work properly. I have 3 tabs each with their own menu. When a page is displayed a menu and a sub menu is automatically displayed. Once it's displayed the user can hover over the tabs to see the other sub menus and when they stop hovering the originally sub menu appears. My issue is that although, I can show them the sub menu of the other tabs, I can't keep the sub menu open for the user to click on a sub menu item. Other tutorials show how to do this only when the sub menu is nested within a parent

Changing only y pos of background image via Jquery

无人久伴 提交于 2019-11-29 10:55:00
I want to change button's background image y position with hover function. Is there a simple way of keeping xpos or should I get position first, split it and use again with $.css() again. I should change all 3 span's background position if somebody hover's any of them. So bt_first:hover not seems usable. Here is my usage. I wrote #should stay same# to place that I don't want to change value of xpos: $('.bt_first,.bt_sec,.bt_third').hover(function(){ $('.bt_first,.bt_sec,.bt_third').css({'background-position':'#should stay same# -150px'}) },function(){ $('.bt_first,.bt_sec,.bt_third').css({

jQuery hover dependent on two elements

眉间皱痕 提交于 2019-11-29 10:47:55
I have main navigation and sub navigation that for reasons of design are in separate DIVs. I would like to show the appropriate sub-nav when a main nav item is hovered, which I can do, but I also want to keep the sub-nav open if the user moves their mouse outside of the main nav item and into the sub-nav area. The last part is the place where I'm getting stuck. I'm thinking on the hover out I need to do something with setTimeout() and an IF statement, but I have not been able to make any progress in that area. Is that even an approach worth trying? HTML: <div id="mnav"> <ul id="buttons"> <li

How can I keep my sub-menu open in jQuery hover menu?

天大地大妈咪最大 提交于 2019-11-28 08:31:08
问题 I just started coding in jQuery last week and need some help figuring out how to make a menu work properly. I have 3 tabs each with their own menu. When a page is displayed a menu and a sub menu is automatically displayed. Once it's displayed the user can hover over the tabs to see the other sub menus and when they stop hovering the originally sub menu appears. My issue is that although, I can show them the sub menu of the other tabs, I can't keep the sub menu open for the user to click on a

jQuery hover dependent on two elements

霸气de小男生 提交于 2019-11-28 04:02:39
问题 I have main navigation and sub navigation that for reasons of design are in separate DIVs. I would like to show the appropriate sub-nav when a main nav item is hovered, which I can do, but I also want to keep the sub-nav open if the user moves their mouse outside of the main nav item and into the sub-nav area. The last part is the place where I'm getting stuck. I'm thinking on the hover out I need to do something with setTimeout() and an IF statement, but I have not been able to make any