Solved

javascript code

Posted on 2011-09-29
10
192 Views
Last Modified: 2012-05-12
Hi,

Does anyone have or know of some code that would do the something similar to this .gif image

where the user click on the errow it will drop down and when they click on it again it will go back up just like ebay home page.  

Thank you
sample.gif
0
Comment
Question by:lulu50
[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
  • 6
  • 4
10 Comments
 
LVL 55

Expert Comment

by:Huseyin KAHRAMAN
ID: 36815802
here is a sample using jQuery
<html>
<head>
			<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript" ></script>
<style>
	.divCollapsablePanel {cursor:pointer}
</style>
	
<script>
$(document).ready(function() {
	$(".divCollapsablePanel").click(function(){$("div",this).toggle(1000);});
});
</script>
</head>
<body>

<div class="divCollapsablePanel">
	Error
<div style="display:none">
	error details
	<ul>
		<li>error 1</li>
		<li>error 2</li>
		<li>error 3</li>
	</ul>
</div>
</div>

<div class="divCollapsablePanel">
	Stack
<div style="display:none">
	Stack details
	<ul>
		<li>Stack 1</li>
		<li>Stack 2</li>
		<li>Stack 3</li>
	</ul>
</div>
</div>

</body>
</html>

Open in new window

0
 

Author Comment

by:lulu50
ID: 36816517

I have two questions:

what if code.jquery.com removes all their files is that mean my menu will not work
anymore?

<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript" ></script>

my second question.

I just found on the internet something similar to what I am looking for

http://javascript.internet.com/navigation/category-menus.html

the code you just posted it doesn't close when the user select a different category like the one in the javascript page.

is there a way to have only the clicked on category open and the rest closed?

0
 
LVL 55

Expert Comment

by:Huseyin KAHRAMAN
ID: 36817238
what if code.jquery.com removes all their files is that mean my menu will not work anymore?

get the files and put into your web server and use that one, do not refer to jQuery site

is there a way to have only the clicked on category open and the rest closed?

yes, will prepare extended sample later...
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 55

Accepted Solution

by:
Huseyin KAHRAMAN earned 500 total points
ID: 36817404
here is the extended version
<html>
<head>
			<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript" ></script>
<style>
	.divCollapsablePanel {cursor:pointer}
	.divCollapsablePanelDetail {border:1px solid silver; padding:10; display:none}
</style>
	
<script>
$(document).ready(function() {
	$(".divCollapsablePanel").click(function(){
		$(".divCollapsablePanelDetail").hide();
		$(".divCollapsablePanelDetail",this).show(1000);
	});
});
</script>
</head>
<body>

<div class="divCollapsablePanel">
	Error
<div class="divCollapsablePanelDetail">
	error details
	<ul>
		<li>error 1</li>
		<li>error 2</li>
		<li>error 3</li>
	</ul>
</div>
</div>

<div class="divCollapsablePanel">
	Stack
<div class="divCollapsablePanelDetail">
	Stack details
	<ul>
		<li>Stack 1</li>
		<li>Stack 2</li>
		<li>Stack 3</li>
	</ul>
</div>
</div>

<div class="divCollapsablePanel">
	Other
<div class="divCollapsablePanelDetail">
	Other details
	<ul>
		<li>Other 1</li>
		<li>Other 2</li>
		<li>Other 3</li>
	</ul>
</div>
</div>

</body>
</html>

Open in new window

0
 
LVL 55

Expert Comment

by:Huseyin KAHRAMAN
ID: 36817421
and you may ask for effect duration:

$(".divCollapsablePanelDetail",this).show(1000);
-->
$(".divCollapsablePanelDetail",this).show(); // to show immediately without any effect
-->
$(".divCollapsablePanelDetail",this).show(250); //1/4 sec for show effect
0
 

Author Comment

by:lulu50
ID: 36817559
HainKurt

do you know where I can get this library jquery-latest.min.js?

0
 
LVL 55

Expert Comment

by:Huseyin KAHRAMAN
ID: 36817705
get it from here jquery.com
copy to your web server and reference to that library
make sure you use min version in your prod site for best performance...
0
 
LVL 55

Expert Comment

by:Huseyin KAHRAMAN
ID: 36817717
learn jQuery, at least basic things :)
0
 

Author Comment

by:lulu50
ID: 36817736
I got it

Thanks,

Yes, I will try to learn it
0
 

Author Closing Comment

by:lulu50
ID: 36817741
Great!!!! Thank you for helping me
0

Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

707 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