inherit
97680
0
Mar 30, 2015 0:36:09 GMT -8
°•.DANI DARKO.•°
574
January 2007
darknisfalls
|
Post by °•.DANI DARKO.•° on May 25, 2013 8:06:54 GMT -8
Reference 1: avaricexx.proboards.com/index.cgi (welcome table under "staff" tab) Reference 2: anikira.proboards.com/ (sidebar under "staff" tab) In both of these examples, when you click an image it triggers text to appear underneath (or next to it or whatever.) Can someone please tell me what code will let me do this? If it helps to know, my goal is to a few images right next to each other like in the "Staff" section of this site's sidebar. And when you click each image I want a description to appear underneath the row of images.
|
|
inherit
I need a new CT, thinking.... [insert Jeopardy theme song here]
110769
0
Aug 21, 2021 0:07:21 GMT -8
Tumbleweed
20,825
September 2007
tumbleweed
|
Post by Tumbleweed on May 25, 2013 16:04:08 GMT -8
|
|
inherit
97680
0
Mar 30, 2015 0:36:09 GMT -8
°•.DANI DARKO.•°
574
January 2007
darknisfalls
|
Post by °•.DANI DARKO.•° on May 26, 2013 16:31:03 GMT -8
Oh sorry about that, I didn't know what it was called. I was just making up names. Thanks for the link! I have two questions. 1) How can I make it so that the collapsible items are already hidden on default? 2) Is it possible to set it so that when you click on a link the content from the previous link goes away? So if I click image one and make the content appear, I want it so that when I click image two, the content from image one hide automatically but the content from image two appears so that they replace one another.
|
|
inherit
I need a new CT, thinking.... [insert Jeopardy theme song here]
110769
0
Aug 21, 2021 0:07:21 GMT -8
Tumbleweed
20,825
September 2007
tumbleweed
|
Post by Tumbleweed on May 26, 2013 19:30:23 GMT -8
Oh sorry about that, I didn't know what it was called. I was just making up names. Thanks for the link! I have two questions. You made me bust out laughing with that making up names. lol Rather than the collapse code in the link I gave you, try this: (It's jquery.) This would go above your side table: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script> <script> jQuery(function(){ jQuery('#showall').click(function(){ jQuery('.targetDiv').show(); }); jQuery('.showOne').click(function(){ jQuery('.targetDiv').hide(); jQuery('#div'+$(this).attr('target')).show(); }); }); </script> <style> .my_images img{ width: 47px; height: 100px; } .targetDiv{ width:200px; height: 100px; background-color: #bbaaaa; } </style> And then this goes in your side table: The first part you put your images and the second part your content. The content will be hidden at first and switch content when clicke. <div class="my_images"> <a class="showOne" target="1"><img src="http://image1.jpg"></a> <a class="showOne" target="2"><img src="http://image2.jpg"></a> <a class="showOne" target="3"><img src="http://image3.jpg"></a> <a class="showOne" target="4"><img src="http://image4.jpg"></a> </div> <div id="div1" class="targetDiv" style="display: none;">Content 1</div> <div id="div2" class="targetDiv" style="display: none;">Content 2</div> <div id="div3" class="targetDiv" style="display: none;">Content 3</div> <div id="div4" class="targetDiv" style="display: none;">Content 4</div> Let me know if that works for you. Oh, and you'll notice some css with it. You can style the content box as you wish but be sure to put the width and height of the images you'll use in that css. On a side note, when you to convert to V5, if you haven't already, this should work in V5. I can't see your first post at the moment so don't remember if you provided a link to your site.
|
|
inherit
97680
0
Mar 30, 2015 0:36:09 GMT -8
°•.DANI DARKO.•°
574
January 2007
darknisfalls
|
Post by °•.DANI DARKO.•° on May 26, 2013 22:23:40 GMT -8
Yes this is definitely a lot closer to what I am looking for and it is working beautifully so far. I just have one more question. In addition to having the expanded content replace one another, I also still want to be able to hide it again when you double-click the link. Ah and I just realized I hadn't linked my site. Sorry about that, I could've sworn I did. Here it is: www.testdryve2.proboards.com
|
|
inherit
I need a new CT, thinking.... [insert Jeopardy theme song here]
110769
0
Aug 21, 2021 0:07:21 GMT -8
Tumbleweed
20,825
September 2007
tumbleweed
|
Post by Tumbleweed on May 27, 2013 1:56:22 GMT -8
°•.DANI DARKO.•°, That's o.k. Add the blue to that jquery I gave you. <script> jQuery(function(){ jQuery('#showall').click(function(){ jQuery('.targetDiv').show(); }); $(".showOne").dblclick(function(){ jQuery('.targetDiv').hide(); }); jQuery('.showOne').click(function(){ jQuery('.targetDiv').hide(); jQuery('#div'+$(this).attr('target')).show(); }); }); </script>
|
|
inherit
97680
0
Mar 30, 2015 0:36:09 GMT -8
°•.DANI DARKO.•°
574
January 2007
darknisfalls
|
Post by °•.DANI DARKO.•° on May 27, 2013 8:32:48 GMT -8
It worked but I think I might have worded my vision inaccurately. Instead of having to literally double click the image, I wanted to have it so that a single click would toggle the content on/off. So that clicking an image once would show it and clicking the same image once more would hide it, but clicking the next image once while the previous content was displayed would replace the previous content with the new information.
|
|
inherit
I need a new CT, thinking.... [insert Jeopardy theme song here]
110769
0
Aug 21, 2021 0:07:21 GMT -8
Tumbleweed
20,825
September 2007
tumbleweed
|
Post by Tumbleweed on May 27, 2013 14:59:32 GMT -8
I'm fairly new to jquery and I can't think how I'd get the browser to keep track how many times something was clicked. In this case, one click to show and the second click to hide, especially if someone is clicking all of them off and on, going back and forth. It might be something really simple, I'm not thinking of or maybe it can't be done. (unlikely) The only way I can think to do it is by having some text to close them all just as you can have a link to open them all. But I know that isn't what you want.
I promise, if my brain kicks in on how to do this, I'll be sure to post it.
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,018
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on May 29, 2013 14:11:30 GMT -8
Try replacing the section that sets the click handler with this
jQuery('.showOne').click(function () { var viz = jQuery('#div'+$(this).attr('target')+':visible').length; jQuery('.targetDiv').hide(); jQuery('#div' + $(this).attr('target'))[viz?"hide":"show"](); });
|
|
inherit
97680
0
Mar 30, 2015 0:36:09 GMT -8
°•.DANI DARKO.•°
574
January 2007
darknisfalls
|
Post by °•.DANI DARKO.•° on May 31, 2013 21:41:07 GMT -8
That worked perfectly Eton Bones. Thank you both so much for your help. It was greatly appreciated!
|
|