Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

javascript code

Posted on 2011-09-29
10
Medium Priority
?
203 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 60

Expert Comment

by:HainKurt
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 60

Expert Comment

by:HainKurt
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 60

Accepted Solution

by:
HainKurt earned 2000 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 60

Expert Comment

by:HainKurt
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 60

Expert Comment

by:HainKurt
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 60

Expert Comment

by:HainKurt
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

618 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