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.

Back to top button

View previous topic View next topic Go down

Solved Back to top button

Post by lightningterror on February 13th 2013, 2:38 am

Hello ,

I'm trying to add a "Back to top" button on my forum however the code doesn't work , can anyone help me out with this?

The code I'm using is from http://davidwalsh.name/jquery-top-link

The error I'm getting is

Uncaught TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'scrollTo' 30305.js:1
(anonymous function) 30305.js:1
f.event.dispatch jquery.min.js:3
f.event.add.h.handle.i

lightningterror
Forumember

Male Posts : 45
Reputation : 5
Language : English

http://hellguards.nice-forum.com/

Back to top Go down

Solved Re: Back to top button

Post by lightningterror on February 13th 2013, 2:41 am

In a widget.

lightningterror
Forumember

Male Posts : 45
Reputation : 5
Language : English

http://hellguards.nice-forum.com/

Back to top Go down

Solved Re: Back to top button

Post by lightningterror on February 13th 2013, 2:44 am

I put the javascript in the Javascript codes management (checked it in all pages) , and css in the CSS Stylesheet

lightningterror
Forumember

Male Posts : 45
Reputation : 5
Language : English

http://hellguards.nice-forum.com/

Back to top Go down

Solved Re: Back to top button

Post by lightningterror on February 13th 2013, 3:31 am

Code:
jQuery.fn.topLink = function(settings) {
  settings = jQuery.extend({
    min: 1,
    fadeSpeed: 200
  }, settings);
  return this.each(function() {
    //listen for scroll
    var el = $(this);
    el.hide(); //in case the user forgot
    $(window).scroll(function() {
      if($(window).scrollTop() >= settings.min)
      {
        el.fadeIn(settings.fadeSpeed);
      }
      else
      {
        el.fadeOut(settings.fadeSpeed);
      }
    });
  });
};

//usage w/ smoothscroll
$(document).ready(function() {
  //set the link
  $('#top-link').topLink({
    min: 400,
    fadeSpeed: 500
  });
  //smoothscroll
  $('#top-link').click(function(e) {
    e.preventDefault();
    $.scrollTo(0,300);
  });
});

The problem must be smoothscroll effect because without it the code works.

edit: nvm about this code , found a working one at http://gazpo.com/2012/02/scrolltop/

you can lock the topic Smile

lightningterror
Forumember

Male Posts : 45
Reputation : 5
Language : English

http://hellguards.nice-forum.com/

Back to top Go down

Solved Re: Back to top button

Post by Sanket on February 13th 2013, 4:54 am

Topic Solved & Locked

Sanket
ForumGuru

Male Posts : 48766
Reputation : 2819
Language : English
Location : Mumbai

http://webartzforum.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