vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   jQuery Spoiler Help (https://vborg.vbsupport.ru/showthread.php?t=220198)

James Birkett 08-04-2009 08:50 PM

jQuery Spoiler Help
 
I'm coding a spoiler using jQuery. I have an error though.
I know the error, I just can't re-code it to fix it! Frustration :(
HTML Code:

<style type="text/css">
p#spoilercontent{
display:none;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
        $(function()        {
                $('p#spoiler').click(function()        {
                        $('p#spoilercontent').toggle(400);
                });
        });
</script>
<div align="center">
<strong><p id="spoiler"><u>Spoiler:</u></strong><br />
<p id="spoilercontent">{param}</p>
</div>

That's my code, and the problem is it's controlling all spoilers not that one. I need to use $(this). but I can't re-code it to use that.

Any help is appreciated.

1Unreal 08-05-2009 05:36 AM

You need to use "this".

http://css-tricks.com/fade-in-spoiler-revealer/

James Birkett 08-05-2009 02:41 PM

I know I need to use $(this), I just can't recode it to use it. I'm stumped

MrC_53 09-24-2009 02:02 PM

Dude, the code are ok, i put the code in my forum and work perfectly

what is your problem?

James Birkett 09-24-2009 05:05 PM

This is an old thread, I forgot I posted it :rolleyes:

The problem is that when clicked it toggles all ID's of spoiler within the paragraph tag, and not the one that is clicked.

It needed to be re-coded using ($this), which I never got round to doing.


All times are GMT. The time now is 08:42 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01472 seconds
  • Memory Usage 1,716KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete