Script Jquery

Started by Grosraisin, June 23, 2011, 06:47:19 PM

Previous topic - Next topic

Grosraisin

Hello,

I called on you to try to understand why script. It allows you to automatically resize the background. http://johnpatrickgiven.com/jquery/background-resize/


<script language="JavaScript" type="text/javascript" src="', $settings['theme_url'], '/scripts/jquery.ez-bg-resize.js"></script>
<script>
$(document).ready(function() {
$("body").ezBgResize({
img     : "', $settings['theme_url'], '/images/theme/bg.jpg",
});
});
</script>


Does not want to run. (it is well placed in the HEAD) and working on my home page

Thank you, I have forgotten something but what.

SMF / Le Partage et l'Entraide
SMF / Sharing and Caring


Mes modifications de Mods / Templates



Suki

do you have jquery called on your head tags?


do you have $settings globalized on your function?

global $settings;


do you have the jquery.ez-bg-resize.js  file in your theme's scripts folder?
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Grosraisin

#2
Yes this is all done.

Image well placed in "Themes/default/images/theme/bg.jpg"
Script in "Themes/default/scripts/jquery.ez-bg-resize.js"

Code:
index.template.php

after -->
// Here comes the JavaScript bits!
echo '


<script language="JavaScript" type="text/javascript" src="', $settings['theme_url'], '/scripts/jquery.ez-bg-resize.js" charset="utf-8"></script>
<script>
$(document).ready(function() {
$("body").ezBgResize({
img     : "', $settings['theme_url'], '/images/theme/bg.jpg",
});
});
</script>


Thanks you


Update:
Here is the error I get:
jQuery is not defined [Resolved]
})(jQuery);
$ is not defined [Resolved]
$(document).ready(function() {
By:
<script src="http://www.google.com/jsapi"></script>
<script>google.load("jquery", "1");</script>


Now
$("body") is null
$("body").ezBgResize({

SMF / Le Partage et l'Entraide
SMF / Sharing and Caring


Mes modifications de Mods / Templates



Grosraisin

French:
Problème résolu sur une nouvelle installation de SMF 2.0. Je devrais pouvoir comprendre le pourquoi du comment sa fonctionnais pas.

English:
Problem solved on a fresh install of SMF 2.0. I should be able to understand why and how its not work.

SMF / Le Partage et l'Entraide
SMF / Sharing and Caring


Mes modifications de Mods / Templates



DragoN_PT

How can I get this to work in Blackbox?

Grosraisin

For other users who have problems here are the changes to do:
"Index.template.php"
// Here comes the JavaScript bits!
echo '

after
<script src="http://www.google.com/jsapi"></script>
<script>google.load("jquery", "1");</script>
<script language="JavaScript" type="text/javascript" src="', $settings['theme_url'], '/scripts/jquery.ez-bg-resize.js" charset="utf-8"></script>
<script>
$(document).ready(function() {
$("body").ezBgResize({
img     : "', $settings['theme_url'], '/images/theme/background.jpg",
});
});
</script>


"index;css"
body
{
font: 78%/130% verdana, Helvetica, sans-serif;
background: #131313;
margin: 0;
padding: 0;
}

remplace
body
{
font: 78%/130% verdana, Helvetica, sans-serif;
margin: 0;
padding: 0;
}


div#wrapper
{
width: 960px;
margin: 0 auto;
padding: 0;
}

remplace
div#wrapper
{
width: 960px;
margin: 80px auto;
padding: 0;
}

SMF / Le Partage et l'Entraide
SMF / Sharing and Caring


Mes modifications de Mods / Templates



DragoN_PT

Yes. Thanks to Grosraisin Ive made it work on my end.

Thanks ( one more time  :P  ) for all the patience and help that you gave me. Very cool guy!  ;)

Advertisement: