MyBB Community Forums

Full Version: How jQuery "Slide Toggle" work?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I would like to make a jquery's slide toggle on the button "Sign In" where it will drop down the menu.
Website: http://www.Vizzy.VisualizeEdits.com/

About jQuery Toggle with the .slideToggle() function:
Website: http://rijamedia.com/blog/2011/01/simple...idetoggle/
The jQuery function:
$('#toggle4').click(function() {
	$('.toggle4').slideToggle('fast');
	return false;
});
The jQuery HTML Code:
<a href="#" id="toggle4">Slide Toggle</a><br /><br />
<div class="toggle4" style="display:none; background-color:#4CF;width:100px;height:200px;"></div>

I put the html in the header like this:
http://gyazo.com/2086299c732613247607b1d675ec0a3d

But I don't know where I put the function code. Am I doing it right?
Put the function in a seperate .js file the link to the .js file in the head of your html page.

<script type="text/javascript" src="/file.js"></script>
(2013-07-09, 09:37 PM)Jambuster Wrote: [ -> ]Put the function in a seperate .js file the link to the .js file in the head of your html page.

Like this? http://gyazo.com/45b68f0523431b1a6c8a55352f5492d0

How do I make a javascript file? And link it to the header?

I really need to clean my header template so that I can make it more clearer.

(2013-07-09, 09:37 PM)Jambuster Wrote: [ -> ]Put the function in a seperate .js file the link to the .js file in the head of your html page.

I put my HTML in here
http://gyazo.com/af13d95100875dc8cd02a4e8cd566d8e

but where's the "head" to put the script in?
^ javascript file can be linked in headerinclude template (ungrouped templates)
(2013-07-10, 03:08 AM).m. Wrote: [ -> ]^ javascript file can be linked in headerinclude template (ungrouped templates)

So I put the "function" into the headerinclude template, or the
script Jambuster mentioned above?

I know about the html, I think but just need a little help with the script since I'm very new to how javascript work in MyBB.
helo bro. This works just like a spoiler.

Better use the plugin: http://mods.mybb.com/view/spoiler-bbcode
(2013-07-10, 03:51 AM)ikhwanulfikri Wrote: [ -> ]helo bro. This works just like a spoiler.

Better use the plugin: http://mods.mybb.com/view/spoiler-bbcode

Yeah, I would but I don't think I can use those tags in html? Since it's a BBCode.

I put the code mentioned above into here.
http://gyazo.com/97320385f259cff2fd635e24df7c29cb (I think I have to rename the "file" to something else.

and I know where to put the html, I place it into here
http://gyazo.com/61a91eb4596e065327744a3a0b455bb3 (Didn't published it because I will have to fix the layout since it got messed up but got to see how it work first.)

and for the function code, I believe I put it into the global.php but I could be wrong.

Any help?
hi bro.

add the code in global.css not in global.php

just install it and enter this code in global.css

.spoiler_header {
    background: #FFF;
    border: 1px solid #CCC;
    padding: 4px;
    margin: 4px 0 0 0;
    color: #000;
}

.spoiler_body {
    background: FFF;
    padding: 4px;
    border: 1px solid #CCC;
    border-top: 0;
    color: #000;
    margin: 0 0 4px 0;
}

to make it work in a thread or post use this code:

[spoiler] your word [/spoiler] or [spoiler=CHEESE!]This is a spoiler[/spoiler]

and done.
for the javascript function, please follow the method in post #2 and add suggested code in headerinclude template
(2013-07-09, 09:37 PM)Jambuster Wrote: [ -> ]Put the function in a seperate .js file the link to the .js file in the head of your html page.

How do you make a seperate .js file? When you say "head of your html page", do that mean heading (header template)? or the actual "<head>" tags?
Pages: 1 2 3