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

Headers as links #1

Open
arjunmenon opened this issue Feb 13, 2014 · 6 comments
Open

Headers as links #1

arjunmenon opened this issue Feb 13, 2014 · 6 comments

Comments

@arjunmenon
Copy link

hey
pretty sleek script. can the headers also function as links, so when clicked it scrolls to that section and open the content. something like accordion but slinky.

thanks.

@mikila85
Copy link

mikila85 commented Nov 4, 2015

almost two years... i guess project is dead ... sad..
if anyone finds a project like this that has clickable headers please comment a link below.
thx.

@iclanzan
Copy link
Owner

iclanzan commented Nov 4, 2015

@mikila85 I have since moved away from jQuery for building web apps. If you or someone else implements this functionality I would have no problem merging it.

@mikila85
Copy link

mikila85 commented Nov 4, 2015

Me too i need it for angular project. Tomorrow at work ill try making it work

@mikila85
Copy link

mikila85 commented Nov 8, 2015

Hi,
I tried using targeting to reach the requested

when clicked on the corresponding .
but im stuck with it scrolling just to the top of the page (ignoring the stacked headers position above it and therefore few hundred pixels are invisible because the stacked headers above are hiding the start of the content.

any chance to get help from you trying to sort it out?

p.s.
i tried doing $(window).scrollTop($("#myanchor").offset().top-(header.height * stackedHeaders);
but the offset() is wrong i think that slinky changes it because on test page it worked without slinky.

@mikila85
Copy link

mikila85 commented Nov 8, 2015

Got it! :)

when doing:
// Pre-calculate the offsets that the headers would have
// from the top or bottom of the scroller.

in the foreach i added:
headers[i].$.click(function () { scrollToArticle(i); });

and a function

function scrollToArticle(i) {
var articleTop = headers[i].$.context.offsetTop - headers[i].top;
$scroller.scrollTop(articleTop);
}

@sukiec
Copy link

sukiec commented Nov 10, 2015

@mikila85

This functionality is just what I'm looking for! Could you please elaborate on how you modified the core code? perhaps include a demo link? Thanks much!!!

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

4 participants