Solved

jQuery and Hover

Posted on 2011-09-27
5
356 Views
Last Modified: 2012-05-12
I currently have an jQuery accordion plugin working on a list.  I want to add the ability to hover over one of the list items and see relavent info.

If I hover over Brokerage #1, I want to see Brokerage #1, Location: England, Producer Code: Brok1.

How do I do this?  An example of my actual UL is below.

 
<div class="accordion-content">
		  <ul>
            <li class="left-nav-selected"><a href="http://xxx?id=101" title="Willis of New York, Inc.">Willis of New York, Inc.</a><ul><li class="locations">Chicago<br/> Producer Code: PF68</li></ul></li>
			<li class="left-nav-item"><a href="http://xxx?id=102" title="Brokerage #1">Brokerage #1</a><ul><li class="locations">England<br/> Producer Code: Brok1</li></ul></li>
			<li class="left-nav-item"><a href="http://xxx?id=103" title="Brokerage #2">Brokerage #2</a><ul><li class="locations">Ireland<br/> Producer Code: Brok2</li></ul></li>
			<li class="left-nav-item"><a href="http://xxx?id=104" title="Brokerage #3">Brokerage #3</a><ul><li class="locations">Germany<br/> Producer Code: Brok3</li></ul></li>

Open in new window

0
Comment
Question by:jackjohnson44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 56

Expert Comment

by:HainKurt
ID: 36711854
does "see relavent info" mean open it, or show data in a tooltip?
0
 

Author Comment

by:jackjohnson44
ID: 36711894
sorry, I'd like to see it in a tooltip/dialogue which disappears when you go away.  I think that a standard tool tip might be too small. Ideally Id like a div or something that I can apply style to.  They didn't mention this, but I am sure it is coming.

Thanks!
0
 
LVL 56

Expert Comment

by:HainKurt
ID: 36712092
something like this may work for you
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://cdn.jquerytools.org/1.2.6/full/jquery.tools.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://static.flowplayer.org/tools/css/standalone.css"/>
<style>
/* tooltip styling. by default the element to be styled is .tooltip  */
.tooltip {
	display:none;
	background:transparent url(http://static.flowplayer.org/tools/img/tooltip/black_arrow.png);
	font-size:12px;
	height:70px;
	width:160px;
	padding:25px;
	color:#fff;	
}
</style>

<script>
    $(document).ready(function(){

$(".accordion-content ul li a[title]").tooltip();

    });
</script>

<div class="accordion-content">
		  <ul>
		  <li class="left-nav-selected"><a href="http://xxx?id=101" title="Willis of New York, Inc.">Willis of New York, Inc.</a><ul><li class="locations">Chicago<br/> Producer Code: PF68</li></ul></li>
			<li class="left-nav-item"><a href="http://xxx?id=102" title="Brokerage #1">Brokerage #1</a><ul><li class="locations">England<br/> Producer Code: Brok1</li></ul></li>
			<li class="left-nav-item"><a href="http://xxx?id=103" title="Brokerage #2">Brokerage #2</a><ul><li class="locations">Ireland<br/> Producer Code: Brok2</li></ul></li>
			<li class="left-nav-item"><a href="http://xxx?id=104" title="Brokerage #3">Brokerage #3</a><ul><li class="locations">Germany<br/> Producer Code: Brok3</li></ul></li>
			</ul>
</div>

Open in new window

0
 
LVL 56

Expert Comment

by:HainKurt
ID: 36712145
you can use positioning

$(".accordion-content ul li a[title]").tooltip({position: "bottom"});
0
 
LVL 56

Accepted Solution

by:
HainKurt earned 500 total points
ID: 36712180
a better example

go here for full demo and how to use this nice tooltip plug in for jQuery

http://flowplayer.org/tools/tooltip/index.html
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://cdn.jquerytools.org/1.2.6/full/jquery.tools.min.js"></script>
<style>
/* tooltip styling. by default the element to be styled is .tooltip  */
.tooltip {
	display:none;
	background:transparent url(http://static.flowplayer.org/tools/img/tooltip/black_arrow.png);
	height:120px;
	width:210px;
	padding:25px;
	color:#fff;	
}
</style>

<script>
    $(document).ready(function(){

$(".accordion-content ul li a[title]").tooltip({position: "top center"});

    });
</script>

<div class="accordion-content">
		  <ul>
		  <li class="left-nav-selected"><a href="http://xxx?id=101" title="Willis of New York, Inc.">Willis of New York, Inc.</a><ul><li class="locations">Chicago<br/> Producer Code: PF68</li></ul></li>
			<li class="left-nav-item"><a href="http://xxx?id=102" title="Brokerage #1">Brokerage #1</a><ul><li class="locations">England<br/> Producer Code: Brok1</li></ul></li>
			<li class="left-nav-item"><a href="http://xxx?id=103" title="Brokerage #2">Brokerage #2</a><ul><li class="locations">Ireland<br/> Producer Code: Brok2</li></ul></li>
			<li class="left-nav-item"><a href="http://xxx?id=104" title="Brokerage #3">Brokerage #3</a><ul><li class="locations">Germany<br/> Producer Code: Brok3</li></ul></li>
			</ul>
</div>

Open in new window

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question