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

link to anchor #99

Closed
sbsmatt opened this issue Sep 24, 2013 · 2 comments
Closed

link to anchor #99

sbsmatt opened this issue Sep 24, 2013 · 2 comments

Comments

@sbsmatt
Copy link

sbsmatt commented Sep 24, 2013

links to anchors are no longer working since we installed this.

@malihu
Copy link
Owner

malihu commented Sep 24, 2013

You need to use plugin's scrollTo method in order to scroll to a specific point within your content. Instructions and examples in section "scrollTo" under "Plugins methods":
http://manos.malihu.gr/jquery-custom-content-scroller/#methods-section

@sbsmatt
Copy link
Author

sbsmatt commented Sep 25, 2013

I found lots of code for that online which I couldn't get to work, so I will leave this new working code here, which lets the original unchanged anchors work:

$(document).ready(function() {
$("a").click(function() {
if($(this).attr('href') == "#top"){
//this bit is for wordpress, where top is default: .entry-title
var elID=".entry-title";
$(".jsoverflow").mCustomScrollbar("scrollTo",elID);
}else{
if ($(this).attr('href').indexOf("#") >= 0){
//this bit is for any other anchor
$(".jsoverflow").mCustomScrollbar("scrollTo",$(this).attr('href'));
}
}
});
});

@sbsmatt sbsmatt closed this as completed Sep 25, 2013
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