Log in

View Full Version : Javascript question


SilverDragonTears
03-29-2012, 02:46 PM
Can anyone familiar with javascript tell me how to make this scroll horizontal instead of vertical?

//################################################## ########################//
// Scrolling background Tutorial Code by http://www.kudoswebsolutions.com
// Original Source code: http://youlove.us/
// Modified and extended by Kudos Web Solutions
// copyright 2009 kudoswebsolutions.com
//################################################## ########################//

$(function() {
// Define the height of your two background images.
//The image to scroll
var backgroundheight = 2000;
//The image to overlay
var backgroundheight_two = 1000;
// Create a random offset for both images' starting positions
offset = Math.round(Math.floor(Math.random()* 2001));


function scrollbackground() {
//Ensure all bases are covered when defining the offset.
offset = (offset < 1) ? offset + (backgroundheight - 1) : offset - 1;
// Put the background onto the required div and animate vertically
$('#container').css("background-position", "50% " + offset + "px");
// Enable the function to loop when it reaches the end of the image
setTimeout(function() {
scrollbackground();
}, 100
);
}
function scrollbackground2() {
//Ensure all bases are covered when defining the offset.
offset = (offset < 1) ? offset + (backgroundheight - 1) : offset - 1;
// Put the background onto the required div and animate vertically
$('#container2').css("background-position", "50% " + offset + "px");
// Enable the function to loop when it reaches the end of the image
setTimeout(function() {
scrollbackground2();
}, 100
);
}

// Initiate the scroll
scrollbackground();
scrollbackground2();

// Use the offset defined earlier and apply it to the div.
$('#overlay').css("background-position", "50% " + offset2 + "px");
$('#overlay2').css("background-position", "50% " + offset2 + "px");
});

solskenn
03-29-2012, 03:40 PM
I'm almost sure you noticed this, especially as (judging from your site) you have more experience than me. However I'll post it anyways in case it got overlooked or something...

" offset = (offset < 1) ? offset + (backgroundheight - 1) : offset - 1;
// Put the background onto the required div and animate vertically
$('# "

Do you think changing the "vertically" on both background things to "horizontally" would fix that? I'm sorry if you already tried this.. or if maybe it won't do anything at all to edit it.. just a thought/suggestion.

(I can't make codes, but /sometimes/ I can edit /little/ things if I can figure out what it does and how to move it. Though its a slow process ...)

SilverDragonTears
03-29-2012, 03:45 PM
That part is just a comment so changing the words won't fix it :/ Thanks for trying though :Q:

solskenn
03-29-2012, 04:03 PM
jQuery (http://www.tonylea.com/2011/jquery-horizontal-scrollbars/)
stock overflow (http://stackoverflow.com/questions/2274627/how-can-i-get-horizontal-scrollbars-at-top-and-bottom-of-a-div)

Well since that didn't help, I did a google.. maybe one of these will help. The first one seems more like a software.. the second one seems more like a guide..

SilverDragonTears
03-29-2012, 04:22 PM
Eh... nothing there is helping me. This is so frustrating.

SilverDragonTears
03-29-2012, 08:25 PM
I worked ALL day on this!! How does it look?
http://taleofdragons.net/adopt.php

Hall of Famer
03-29-2012, 08:49 PM
umm looks like your css is somewhat messed up, I see eggs appearing below the template footer...

SilverDragonTears
03-29-2012, 08:57 PM
Do a hard refresh....

solskenn
03-29-2012, 09:22 PM
OH! No wonder those didn't help ^^;;
I misunderstood and thought you wanted a horizontal scrollbar.. *facepalms*
Sorry -,-

It looks awesome silver, kind of mysterious.

SilverDragonTears
03-29-2012, 09:26 PM
Thanks! ^^