Simple question: How to add custom JavaScript to forum
+2
c3vietk
iamataloss
6 posters
Page 1 of 1
Simple question: How to add custom JavaScript to forum
Hello. I'm wondering how to add custom JavaScript code to my forum? I'm using phpBB2.
Thanks!
Thanks!
Last edited by iamataloss on December 7th 2011, 6:41 am; edited 1 time in total
iamataloss- New Member
- Posts : 17
Reputation : 1
Language : English
Re: Simple question: How to add custom JavaScript to forum
ACP ~> Modules ~> Javascript codes management
Re: Simple question: How to add custom JavaScript to forum
Please read this topic if your forum version is phpBB2.
Below "The applications of this innovation are endless and can completely transform your forum. They are limited only by your imagination and your JavaScript skills " you have to read something important!
Below "The applications of this innovation are endless and can completely transform your forum. They are limited only by your imagination and your JavaScript skills " you have to read something important!
Guest- Guest
Re: Simple question: How to add custom JavaScript to forum
Is it different for jQuery?
As a test, I went to the Javascript codes management page and added the following code:
As a test, I went to the Javascript codes management page and added the following code:
- Code:
$('body').css("display","none");
iamataloss- New Member
- Posts : 17
Reputation : 1
Language : English
Re: Simple question: How to add custom JavaScript to forum
Hello, you can add css at Color >> Css. Jquery
If you want to use jquery, it should look like this one
If you want to use jquery, it should look like this one
- Code:
$(function(){
$("body").css("display","none");});
Re: Simple question: How to add custom JavaScript to forum
why dont you add your css to your css page?
It sounds like you may be making things more difficult then they have to be?
But we would need to know exactly what it is your trying to do and see the scripting your trying to use to better help you in the right direction.
Or explain as much as you can.
It sounds like you may be making things more difficult then they have to be?
But we would need to know exactly what it is your trying to do and see the scripting your trying to use to better help you in the right direction.
Or explain as much as you can.
kirk- Forumaster
- Posts : 11037
Reputation : 653
Language : English,Vulcan,Klingon, Romulan,& Gorn
Re: Simple question: How to add custom JavaScript to forum
Very strange about your code, lol. To give the body selector display: none it's like to hide your forum content, all forum. May you explain more?
Guest- Guest
Re: Simple question: How to add custom JavaScript to forum
As they explained that code was just as a test.
The reason it didn't work is because the script go in to the header of the page. That script would have been executed before the body tag had even loaded. For such scripts which require the DOM to be loaded, you need to contain it within the a jQuery DOM ready function, which means the script will wait until the DOM is fully loaded before executing.
As someone mentioned above that would be this:
The reason it didn't work is because the script go in to the header of the page. That script would have been executed before the body tag had even loaded. For such scripts which require the DOM to be loaded, you need to contain it within the a jQuery DOM ready function, which means the script will wait until the DOM is fully loaded before executing.
As someone mentioned above that would be this:
- Code:
$(function(){
code here
});
LGforum- Hyperactive
- Posts : 2265
Reputation : 264
Language : English
Location : UK
Re: Simple question: How to add custom JavaScript to forum
Exactly, I was trying to think of something that would be a very noticeable test and that was the first thing that came to mind.LGforum wrote:As they explained that code was just as a test.
I thought for sure I had tried that already, I was wrong. Works perfectly, thanks everyone!LGforum wrote:The reason it didn't work is because the script go in to the header of the page. That script would have been executed before the body tag had even loaded. For such scripts which require the DOM to be loaded, you need to contain it within the a jQuery DOM ready function, which means the script will wait until the DOM is fully loaded before executing.
As someone mentioned above that would be this:
- Code:
$(function(){
code here
});
iamataloss- New Member
- Posts : 17
Reputation : 1
Language : English
Re: Simple question: How to add custom JavaScript to forum
Topic Solved & Locked |
Nera.- Energetic
- Posts : 7078
Reputation : 2017
Language : English
Location : -
Similar topics
» New Custom bbCode button with simple function
» Custom JavaScript for Guests
» Simple question about images
» Javascript Pages Question
» Changing Navigation-link names with Javascript question for phpbb2
» Custom JavaScript for Guests
» Simple question about images
» Javascript Pages Question
» Changing Navigation-link names with Javascript question for phpbb2
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum