Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesnt work in Opera #13

Closed
Sh4d0Wx opened this issue Aug 16, 2011 · 8 comments
Closed

Doesnt work in Opera #13

Sh4d0Wx opened this issue Aug 16, 2011 · 8 comments

Comments

@Sh4d0Wx
Copy link

Sh4d0Wx commented Aug 16, 2011

I tried the script in chrome, firefox, safari, ie but it doesnt work in opera..
My version of opera is 11.50 and using Windows..

I really like the this one, probably the best of scripts for scrolling out there, please fix this issue :/

@kswedberg
Copy link
Owner

sorry you're having problems with this in Opera. I just tested in Opera 11.5 Mac and wasn't able to reproduce the problem. I'll try on Windows as soon as I can get to a Windows machine. In the meantime, can you tell me if you see the problem on the demo page at http://plugins.learningjquery.com/smooth-scroll/demo/ ?

thanks

@Sh4d0Wx
Copy link
Author

Sh4d0Wx commented Aug 19, 2011

Yes it works there, i dont know where is the problem :/

@kswedberg
Copy link
Owner

ok. if you can point me to a page I can look at, I can try to help. The more you're able to reduce the test case to the plugin script, the easier it'll be for me to help you.

thanks.

@Sh4d0Wx
Copy link
Author

Sh4d0Wx commented Aug 19, 2011

Actually i think i made it, i changed $('ul#menu li a').smoothScroll(); to

$('ul#menu li a').click(function(event) {
event.preventDefault();
var link = this;
$.smoothScroll({
scrollTarget: link.hash
});
});

And now it works also in Opera.. But i have another question, how can i exclude a link with id of home?

$('ul#menu li a').click(function(event) {
event.preventDefault();
var link = this;
$.smoothScroll({
scrollTarget: link.hash,
exclude: '#home'
});
});
});

I tried this but it doesnt work, i also tried ['#home'], i also changed exclude in defaults to ['#home'] but still nothing, could you help me with this please?

@kswedberg
Copy link
Owner

Sorry about that. That's a documentation error. exclude and excludeWithin are only used in $().smoothScroll(), not $.smoothScroll(). If you use $.smoothScroll() you should either use a more specific selector or handle the exclusion inside the click handler. This should work:

$('#menu li a').click(function(event) {
  event.preventDefault();
  var hash = this.hash;
  if ( hash != '#home' ) {
    $.smoothScroll({
      scrollTarget: hash);
    }
  });
});

@Sh4d0Wx
Copy link
Author

Sh4d0Wx commented Aug 19, 2011

This doesnt work for me, ill explain better..

I have the menu on the home page with all the links, where i use smoothscroll to scroll to different sections #intro, #contact, #about etc.

Now im working on 404 page, i have the same menu there, but only with 1 link and with href to index.html, and now it only scrolls to the top of the page, i want to disable the scrolling for < a id=" home " > not for < a href=" #home " > if i understand correctly how this code works.. I need to disable it for id not hash.. If you could help me with that i would really appreciate it, and I'm sorry if i took much of your time :)

(Sorry my English is not the best)

@kswedberg
Copy link
Owner

In that case you would do this:

$('#menu li a').click(function(event) {
  event.preventDefault();

  if ( this.id != 'home' ) {
    $.smoothScroll({
      scrollTarget: this.hash);
    }
  });
});

@Sh4d0Wx
Copy link
Author

Sh4d0Wx commented Aug 19, 2011

I will make some other way around, but thanks very much for your help, I really appreciate it :)

@Sh4d0Wx Sh4d0Wx closed this as completed Aug 19, 2011
@Sh4d0Wx Sh4d0Wx reopened this Aug 19, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants