Results 1 to 11 of 11

Thread: Using Parallax effect

  1. #1
    User
    Join Date
    10-07-11.
    Posts
    59

    Default Using Parallax effect

    Hi,
    I really want to use a parallax effect on one of my pages (like this:http://stephband.info/jparallax/)

    Has anyone used this or know if it's possible?

    I heard there was a Mootool called mParallax but I can't find it anywhere.

    If I just followed the tutorial on the link, where do I put the javascript?

    Thanks for any advice
    Corrie

  2. #2
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,287

    Default Re: Using Parallax effect

    Quote Originally Posted by corrie
    I heard there was a Mootool called mParallax but I can't find it anywhere.
    https://github.com/ryanmitchell/MooParallax
    Contao Community Moderator
    → Support options

  3. #3
    User
    Join Date
    10-07-11.
    Posts
    59

    Default Re: Using Parallax effect

    Awesome, thank you! If i get it working i'll post a link :D

  4. #4
    User
    Join Date
    10-07-11.
    Posts
    59

    Default Re: Using Parallax effect

    OK, so i'm a total newbie to both Contao and web coding so I really need some help...
    I downloaded the mooparallax link so I've got a 'MooParallax.js' file,
    Where do I put this in contao? Do I upload it? create a template? not a clue!

    Sorry to be such a dunce! ops: I've searched everywhere for tutorials but most tutorials assume a good knowledge of Contao and web coding already.

    Any help greatly appreciated
    C

  5. #5
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,287

    Default Re: Using Parallax effect

    Haven't used the script/plugin until now but it should work something like this (not tested though!):

    • upload the JavaScript file "MooParallax.js" to your webspace and put it somewhere in your files directory (e.g. [TL_ROOT]/tl_files/js/MooParallax/MooParallax.js, where "[TL_ROOT]" is the Contao root/main directory)

      [/*:m:2ngoqlpf]
    • create a new template file "[TL_ROOT]/templates/moo_parallax.html5" (if the "Output format" is set to "HTML" in your "Page layout") and/or a template "[TL_ROOT]/templates/moo_parallax.xhtml" (if the "Output format" is set either to "XHTML Strict" or "XHTML Transitional")

      [/*:m:2ngoqlpf]
    • edit the template "[TL_ROOT]/templates/moo_parallax.html5" (for instance) and put the following code in there:
      Code:
      <script src="<?php echo TL_FILES_URL; ?>tl_files/js/MooParallax/MooParallax.js"></script>
      <script>
      (function($) {
        window.addEvent('domready', function() {
          new MooParallax($(document.body).getElements('.parallax'));
        });
      })(document.id);
      </script>
      [/*:m:2ngoqlpf]
    • add a new content element of type "HTML" and put there your HTML markup (take care for the right image paths and image dimensions!):
      Code:
      <div class="parallax">
         [img]tl_files/images/parallax_drops/0.png[/img]
         [img]tl_files/images/parallax_drops/1.png[/img]
         [img]tl_files/images/parallax_drops/2.png[/img]
         [img]tl_files/images/parallax_drops/3.png[/img]
         [img]tl_files/images/parallax_drops/4.png[/img]
         [img]tl_files/images/parallax_drops/5.png[/img]
         [img]tl_files/images/parallax_drops/6.png[/img]
      </div>
      Of course, instead of a content element you can create a new front end module of type "Custom HTML" as well.

      [/*:m:2ngoqlpf]
    • activate the new MooTools template in your "Page layout" by clicking on the corresponding checkbox "moo_parallax"[/*:m:2ngoqlpf]
    Contao Community Moderator
    → Support options

  6. #6
    User
    Join Date
    10-07-11.
    Posts
    59

    Default Re: Using Parallax effect

    Thank you so much for taking the time to write all that for me, looks like that makes sense, I'll give it a go.

    Thanks again :D

  7. #7
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,287

    Default Re: Using Parallax effect

    I have tested it now - works like a charm so far. You can download the ressources HERE.
    Contao Community Moderator
    → Support options

  8. #8
    User
    Join Date
    10-07-11.
    Posts
    59

    Default Re: Using Parallax effect

    xchs you are a legend - thank you :D

  9. #9
    User
    Join Date
    10-07-11.
    Posts
    59

    Default Re: Using Parallax effect

    ha ha, now to work out how to use this effect on touchscreens!!
    Could I replace the hover effect with touch & drag and clicks with double clicks/taps?

  10. #10
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,287

    Default Re: Using Parallax effect

    Not sure if it is really a good idea to run such scripts even on mobile devices since they are usually quite performance heavy.
    Contao Community Moderator
    → Support options

  11. #11
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Using Parallax effect

    In fact, as long as there is no mouse pointer, there will be no movement to base the position of the layers on. This effect is mute on most mobile devices.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •