vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   BB Code Enhancements - jQuery Spoiler BB Code - Smooth Scrolling (https://vborg.vbsupport.ru/showthread.php?t=213265)

1Unreal 05-08-2009 10:00 PM

jQuery Spoiler BB Code - Smooth Scrolling
 
Ive not seen a very pretty spoiler BB code so I thought I would make one. It uses some really simple jQuery code so its very easy to modify with some other cool effects ;)

Heres a demo

Also, its worth mentioning that if you users browser is slow at parsing javascript they might see the spoiler for a split second.

Anyway, heres how to install it.

Open up the template headinclude, go to the bottom and add this code

HTML Code:

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
        $(document).ready(function(){
                $("#spoilercontent").hide();
                $("#spoilerhead").click(function () {
                        if ($("#spoilercontent").is(":hidden")) {
                                $("#spoilercontent").slideDown("slow");
                        } else {
                                $("#spoilercontent").slideUp("slow");
                        }
                });
        });
</script>

If you are using jQuery somewhere on your site already remove the first line ;)

Next add a new BB code use what ever options you want, but use this for the HTML replacement:

HTML Code:

<div id="spoilerhead" class="thead">Spoiler</div> <div id="spoilercontent" class="alt1">{param}</div>
And youre done!

Indyaboard 05-09-2009 06:52 PM

Very nice, thanks!

Flowsion 05-09-2009 09:49 PM

Pretty stupid if it spoils it before the javascript loads, lol.

TWTCommish 05-09-2009 10:10 PM

You should be able to avoid that problem; just have it hidden by default with the bbCode itself.

Code:

<div id="spoilerhead" class="thead">Spoiler</div> <div id="spoilercontent" class="alt1" style="display: none;">{param}</div>

brandonroy 05-10-2009 08:47 AM

I saw the spoiler in your demo for about 30 seconds (after most of the page loaded all the way) then it finally hid itself.

Princeton 05-10-2009 01:24 PM

no files - moved to graveyard


All times are GMT. The time now is 10:25 PM.

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.00993 seconds
  • Memory Usage 1,726KB
  • 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_code_printable
  • (2)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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