I have a website on which comments are loaded via AJAX. I would like to create some links that point to some specific comments.
I have tried both:
<a name="comment-123"></a>
<a id="comment-123"></a>
It only works when the link #comment-123 is called from the same page. If called from another page, the page displays at its top.
Maybe its because the content is loaded after with javascript?
Related
I am trying to make a link that will return to a specific link that equals that of a link clicked on a main page.
Such that:
<a href="link.html" onclick="set this link to memory" target=home></a>
<a href="a memory of that other link" target=home></a>
The idea is that pages within an iframe can have links that users can follow while staying on the main page and the ability to return to original page that was inserted on that frame from a central link on the main page.
Thanks for everyone's help. I researched this quite a bit and tried to use javascript and jquery but I am far too novice to make anything work.
Only try this:
<a href="javascript:;" onclick="window.memLink = ['link.html', this];" target=home>Copier Link!</a>
<a href="javascript:;" onclick="this.href=window.memLink[0]; this.onclick();" target=home>Dynamic Link!!</a>
Try this Online!!
So basically I developed a workaround. Instead of using the reload the frame function ,which stops working once you navigate away from the src, I link to another page that contains a frame with the contents being the desired src. This way they can navigate to that page within the frame as far as they want and will always be able to return to the original page by refreshing the parent frame with the link I provided. This should work for now. However, this means that for every page I do this with I will have to create 2 pages to host one desired link within my pages that are to be navigated within iframes. Hopefully there will be some simpler way to do this and hopefully it won't cause problems on mobile platforms when I start designing the pages for that purpose.
I have a website that's mostly generated via PHP and uses the jQuery library (v1.11.1). My problem is that I would like to link to anchor tags that are generated dynamically on separate pages.
For example, I have the following link on index.php?page=Home:
And on the page that's loaded when $_GET[page] == "ABC," I have the anchor:
<a name="firstItem"></a>
So far, so good. But when I try to click the link, it redirects to the page without jumping to the anchor. The same behaviour happens if I click Reload. However, if I enter the URL directly into the browser window, it DOES jump to the anchor.
I've found that the problem goes away if I delete the "function detach()" from the jQuery file, but then some other libraries that I've loaded fail to work. Any suggestions?
On website foradacopa.com and most websites I develop, we load partial page content into the current DOM to create a "one page" website experience. When these partial pages have embedded tweet buttons, the first page loaded will display the tweet button properly whereas subsequent pages loaded will not. This is because the Twitter code only does it's magic once, when the code is loaded initially.
To workaround this, you need to manually call a method that will do the magic to turn your static a tag into the iframe embedded button.
twttr.widgets.load()
I found this answer at https://dev.twitter.com/discussions/5642 from #kurrik Arne Roomann-Kurrik.
i have an asp.net application under c#
my application consists of master page and its children
in my master page i set a menu
i need when i click on an item in the menu, i need to call a javascript function to redirect to this page without load the master page again.
for example: i am in home page and i want to redirect to contact us page, when i click in the contact us link in the menu, i need to load only the part of the page that not related to the master page.
i know that to load a part of the page i must use jquery, that's why i use jquery to send json request by a web service to a service and get info and represent these info in contact us page.
Problem:
how can redirect from one page to another without loading master page?
Note:
i try ispostback in master page page load method and windows.location = "contactus" in javascript method
any help?
What you are trying to do is not "redirecting" the user, but rather loading content (via AJAX) with which you will replace a certain area of the page with.
Like you said, you'd do that with jQuery;
jQuery("#selectorToGetTheMainNode").load("http://urlToLoadTheHTMLFrom");
This will automatically load and replace the html present within your MainNode with the loaded content.
I have a small problem. So I have this page that loads dynamic content using jQuery Ajax after the page is done loading. On the top of the page is a link called "Add News". When you click on that Link, a facebox pops open. This link is static and is only displayed once on the top of the page. Its labeled:
<a href="linktopage" rel='facebox[.xhr]'>Add News</a>
The dynamic page (loaded from Ajax) lists all the existing news in the DB. They are labeled:
<a href="linktonews?id=1" rel='facebox[.xhr]'>News 1</a>
<a href="linktonews?id=2" rel='facebox[.xhr]'>News 2</a>
<a href="linktonews?id=3" rel='facebox[.xhr]'>News 3</a>
and so on... Clicking one of the news items, open a facebox where you can view/edit the news.
Every time a new news item is added, the dynamic content reloads without refreshing the page.
The definition of facebox is instantiated using $('a[rel*=facebox]').facebox(); when the main index page is loaded.
Now my problem is that this $('a[rel*=facebox]').facebox(); does not apply to the news content loaded using ajax. So clicking on those links does not open a facebox. How can I achieve this?
Thanks in advance.
I had the same problem so I started looking at the pull requests in GitHub and found:
https://github.com/dator/facebox/commit/5ce6a75927d81b9fff1eeff9b933f0ad93f12801
by Dator (props to him! :D)
As it seems that the pull request isn't merged yet I just changed that line in my facebox.js and it works great :D
Hope this helps :)