Javascript page scroll in Wordpress template.

Discussion in 'JavaScript' started by Xitanto, Aug 1, 2006.

  1. #1
    Hey all.

    I've seen the following effect on this template called Bloxpress2. It's the javascript effect that allows you to navigate from post to post via the up and down arrows.

    The code is as follows:

    'a.contentnext' : function(element) {
            element.onclick = function() {
                lastDiv = Bloxpress.domLast($('posts'));
                postDiv = $(element.parentNode.parentNode.parentNode);
                if (postDiv != lastDiv) {
                    fx = new Effect.ScrollTo(Bloxpress.domAfter(postDiv));
                } else {
                    fx = new Effect.ScrollTo('footer');
                }
            }
        },
        'a.contentprev' : function(element) {
            element.onclick = function() {
                firstDiv = Bloxpress.domFirst($('posts'));
                postDiv = $(element.parentNode.parentNode.parentNode);
                if (postDiv != firstDiv) {
                    fx = new Effect.ScrollTo(Bloxpress.domBefore(postDiv));
                } else {
                    fx = new Effect.ScrollTo('header');
                }
            }
        },
        'a.contentswitch' : function(element) {
            element.onclick = function() {
                var postDiv = element.parentNode.parentNode.parentNode;
                var postContent = document.getElementsByClassName(postContentClass, postDiv);
                postContent.each(function(post) {
                   fx = new Effect.toggle(post, 'blind', {duration:0.5})
                });
            }
        },
    Code (markup):
    How do I integrate this JS code into my current template (Click here to see.)?

    I have moo.fx stored in template/scripts/moo.fx etc, if you can make use of it to do this easier.

    Basically I want to recreate the same thing with my current tamplate by adding two buttons to the far right top side of the post div.
     
    Xitanto, Aug 1, 2006 IP
  2. Xitanto

    Xitanto Peon

    Messages:
    434
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Didn't want to have to bump this, but I may have to unless I get an answer. :(
     
    Xitanto, Aug 2, 2006 IP