The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

How to add paralaxx?

View previous topic View next topic Go down

Solved How to add paralaxx?

Post by Hax4Ever on January 10th 2015, 5:14 pm

So I've read through a ton of posts on how to add parallax scrolling but none of the codes seem to work. Is there any way to add Parallax scrolling into phbb2? I would appreciate help! :/

What I want to do is:

Every 2 pixels scrolled down - the background moves 1 pixel

EVery 2 pixels scrolled up - the background moves 1 pixel.

I dont want to do left and right because that seems pointless.

Lol

Forum link :http://cavestoryroleplay.forumotion.com/


Last edited by Hax4Ever on January 10th 2015, 5:43 pm; edited 1 time in total (Reason for editing : Link)

Hax4Ever
Forumember

Male Posts : 27
Reputation : 2
Language : English
Location : California

http://cavestoryroleplay.forumotion.com/

Back to top Go down

Solved Re: How to add paralaxx?

Post by Hax4Ever on January 10th 2015, 8:35 pm

bumpin' headthumpin'

Hax4Ever
Forumember

Male Posts : 27
Reputation : 2
Language : English
Location : California

http://cavestoryroleplay.forumotion.com/

Back to top Go down

Solved Re: How to add paralaxx?

Post by Swagbito on January 10th 2015, 8:38 pm

Hello,you can only bump after 24 hours have passed.

Swagbito
Forumember

Posts : 176
Reputation : 4
Language : English & Japanese

http://rubbershinobi.forumotion.com/

Back to top Go down

Solved Re: How to add paralaxx?

Post by Hax4Ever on January 11th 2015, 11:19 pm

Bump fo' reals this time.

Hax4Ever
Forumember

Male Posts : 27
Reputation : 2
Language : English
Location : California

http://cavestoryroleplay.forumotion.com/

Back to top Go down

Solved Re: How to add paralaxx?

Post by Hax4Ever on January 14th 2015, 12:19 am

Spoiler:

Hax4Ever
Forumember

Male Posts : 27
Reputation : 2
Language : English
Location : California

http://cavestoryroleplay.forumotion.com/

Back to top Go down

Solved Re: How to add paralaxx?

Post by Ange Tuteur on January 14th 2015, 1:38 am

Hello @Hax4Ever,

Go to Administration panel > Modules > JavaScript codes management > Create a new script

Title : Your choice
Placement : In all the pages
Code:
$(function() {
  var y_thn = window.pageYOffset;
  document.body.style.backgroundPosition = '0px 0px';
 
  window.onscroll = function() {
   
    console.log(document.body.style.backgroundPosition);
    var y_now = window.pageYOffset;
    if (y_now > y_thn) {
      document.body.style.backgroundPosition = '0px ' + Number(getPos() - 1) + 'px';
      y_thn = y_now;
    }
    if (y_now < y_thn) {
      document.body.style.backgroundPosition = '0px ' + Number(getPos() + 1) + 'px';
      y_thn = y_now;
    }
  };
  function getPos() { return Number(document.body.style.backgroundPosition.replace(/0px (.*?)px/,'$1')) }
});

The background should move when you scroll.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: How to add paralaxx?

Post by Hax4Ever on January 14th 2015, 1:46 am

Thank You! This looks amazing.

Hax4Ever
Forumember

Male Posts : 27
Reputation : 2
Language : English
Location : California

http://cavestoryroleplay.forumotion.com/

Back to top Go down

Solved Re: How to add paralaxx?

Post by Ange Tuteur on January 14th 2015, 2:03 am

You're welcome ^^

Topic archived

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum