Hi everybody,
I googeled a bit and I found out that I can set a text anchor in rails
by using link_to. But I can't figure out how to determine the landing
point of that anchor.

My text is like the following:

foo baz baz baz baz baz baz baz baz baz baz read more 1
foo baz baz baz baz baz baz baz baz baz baz baz read more 2

read more 1 anchor
baz baz baz baz baz baz baz baz baz baz...

read more 2 anchor
baz baz baz baz baz baz baz baz baz baz...

where the baz baz part is certainly long enough that i need a text
anchor.

i'd make the "read more 1" a "link_to #read_more_1" and would be
linked to request.url#read_more_1. But how do I tell the page to
display the anchor on top of the page?

I think this has to be very simple, I just don't get it :D

regards

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Walter Lee Davis at Jan 10, 2012 at 2:35 pm

    On Jan 10, 2012, at 7:34 AM, manavortex wrote:

    Hi everybody,
    I googeled a bit and I found out that I can set a text anchor in rails
    by using link_to. But I can't figure out how to determine the landing
    point of that anchor.

    My text is like the following:

    foo baz baz baz baz baz baz baz baz baz baz read more 1
    foo baz baz baz baz baz baz baz baz baz baz baz read more 2

    read more 1 anchor
    baz baz baz baz baz baz baz baz baz baz...

    read more 2 anchor
    baz baz baz baz baz baz baz baz baz baz...

    where the baz baz part is certainly long enough that i need a text
    anchor.

    i'd make the "read more 1" a "link_to #read_more_1" and would be
    linked to request.url#read_more_1. But how do I tell the page to
    display the anchor on top of the page?

    I think this has to be very simple, I just don't get it :D
    The browser is in charge of anything past the hash mark in the URL. You don't do anything besides apply that ID to an element in your page (a P, an Hn, a span, anything that has a position on the page will do) and the browser will do the rest.

    Walter
    regards

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Manavortex at Jan 12, 2012 at 9:33 am
    Works like a charm, thanks a lot. Guess you have to be told. :)
    On 10 Jan., 15:35, Walter Lee Davis wrote:
    On Jan 10, 2012, at 7:34 AM, manavortex wrote:








    Hi everybody,
    I googeled a bit and I found out that I can set a text anchor in rails
    by using link_to. But I can't figure out how to determine the landing
    point of that anchor.
    My text is like the following:
    foo baz baz baz baz baz baz baz baz baz baz read more 1
    foo baz baz baz baz baz baz baz baz baz baz baz read more 2
    read more 1 anchor
    baz baz baz baz baz baz baz baz baz baz...
    read more 2 anchor
    baz baz baz baz baz baz baz baz baz baz...
    where the baz baz part is certainly long enough that i need a text
    anchor.
    i'd make the "read more 1" a "link_to #read_more_1"  and would be
    linked to request.url#read_more_1. But how do I tell the page to
    display the anchor on top of the page?
    I think this has to be very simple, I just don't get it :D
    The browser is in charge of anything past the hash mark in the URL. You don't do anything besides apply that ID to an element in your page (a P, an Hn, a span, anything that has a position on the page will do) and the browser will do the rest.

    Walter








    regards
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 10, '12 at 12:34p
activeJan 12, '12 at 9:33a
posts3
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Manavortex: 2 posts Walter Lee Davis: 1 post

People

Translate

site design / logo © 2021 Grokbase