fragment-identifier

Bootstrap Collapse - open the given id fragment

独自空忆成欢 提交于 2019-11-29 03:12:06
Imagine a Bootstrap collapse with 3 parts <div class="panel-group" id="accordion"> ... <div id="accordionOne" class="panel-heading"></div> ... <div id="accordionTwo" class="panel-heading"></div> ... <div id="accordionThree" class="panel-heading"></div> </div> Is there a simple way to make the plugin open the given HTTP fragment identifier ? Example http://myproject/url#accordionTwo would open the second accordion fxbt $("#accordionTwo").collapse('show'); To open the given HTTP fragment identifier, try this: $(document).ready(function() { var anchor = window.location.hash; $(".collapse")

Encoding of window.location.hash

隐身守侯 提交于 2019-11-28 16:59:10
Does window.location.hash contain the encoded or decoded representation of the url part? When I open the same url ( http://localhost/something/#%C3%BC where %C3%BC translates to ü ) in Firefox 3.5 and Internet Explorer 8, I get different values for document.location.hash : IE8: #%C3%BC FF3.5: #ü Is there a way to get one variant in both browsers? Unfortunately, this is a bug in Firefox as it decodes location.hash an extra time when it is accessed. For example, try this in Firefox: location.hash = "#%30"; location.hash === "#0"; // This is wrong, it should be "#%30" The only cross-browser

Preventing scroll when using URI hash to identify tab

僤鯓⒐⒋嵵緔 提交于 2019-11-28 13:23:27
I'm using JQuery UI to make tabs in my application. I needed the tabs to be linkable (direct link that opens the page and selects the correct tab). This is done by using a hash tag/ fragmented identifier . But I have a issue when the content above the tabs and inside the tabs is very long. When clicking the tabs, the page scrolls down to the start of the tab. This is not what I want. I'm using Jquery 1.7.1 and Jquery UI 1.8.16. The javascript/Jquery code is a standard Jquery UI tabs with the addition to the event "tabsshow". This is suggested in Changing location.hash with jquery ui tabs

window.location.hash = “ ”; prevent scrolling to the top?

谁都会走 提交于 2019-11-28 09:43:29
in my website i set the url adress using window.location.hash = 'project_name'; but if i want to clean the adress url from any hashes (when i close a project) and i set window.location.hash = ''; it happens the page scrolls up to the top page there is any way to clean up the url without any side effect? thanks Andy E There's the onhashchange event, but it cannot be cancelled reliably across browsers to prevent scrolling. The best solution is to record the scroll position before changing the hash location and reset it afterwards. For example, the following code will catch a click on any link ―

Using hash tags with Facebook share possible?

拥有回忆 提交于 2019-11-28 04:25:50
问题 I'm developing an ajax based web site and I want to include a FB share function on the loaded content. The links use a hash tag and I can't manage to get the full links to show up when using the share function, I only get the domain url. Are hash tags not allowed or is there a special method for sharing such links? 回答1: Use URL Encoding for the # character. Just replace the following: http://www.example.com/#/path/to/whatever/ with: http://www.example.com/%23/path/to/whatever/ This will allow

Smooth scroll to anchor after loading new page

纵然是瞬间 提交于 2019-11-28 04:23:27
I want to navigate to an anchor point on a new page, but I want the page to load at the top then immediately smooth scroll to the relevant anchor point. Can this be done? I am a complete newbie with Javascript. This is the js I currently use for smooth scrolling within the current page. I just apply a class of 'scroll' on the link. Thanks very much! <script> $(function(){ $('.scroll').on('click',function(e) { e.preventDefault(); $('html, body').animate({ scrollTop: $($(this).attr('href')).offset().top + 'px' }, 1000, 'swing'); }); }); </script> As browsers automatically detect the hash and

What does #/ means in url?

谁说胖子不能爱 提交于 2019-11-28 03:50:45
问题 I am working on ROR web apps. My webpage url looks like below- http://dev.ibiza.jp:3000/facebook/report?advertiser_id=2102#/dashboard Here I understood that advertiser_id is 2102 but I couldn't understand what #/dashboard is pointing to? 回答1: The portion of the URL which follows the # symbol is not normally sent to the server in the request for the page. If you open your web inspector and watch the request for the page, you will see that the #/dashboard portion is not included in the request

Can you use hash navigation without affecting history?

谁都会走 提交于 2019-11-28 03:03:18
I'm afraid it might be impossible but is there a way to change the hash value of a URL without leaving an entry in the browser's history and without reloading ? Or do the equivalent? As far as specifics go, I was developing some basic hash navigation along the lines of: //hash nav -- works with js-tabs var getHash = window.location.hash; var hashPref = "tab-"; function useHash(newHash) { //set js-tab according to hash newHash = newHash.replace('#'+hashPref, ''); $("#tabs li a[href='"+ newHash +"']").click(); } function setHash(newHash) { //set hash according to js-tab window.location.hash =

Response.Redirect with a fragment identifier causes unexpected refresh when later using location.hash

无人久伴 提交于 2019-11-28 01:33:28
问题 I was hoping someone can assist in describing a workaround solution to the following issue I am running into on my ASP.NET website on IE. In the following I will describe the bug and clarify the requirements of the needed solution. Repro Steps: User visits A.aspx A.aspx uses Response.Redirect to bring the user to B.aspx#house On B.aspx#house, the user clicks a button that sets window.location.hash='test' Actual Results: B.aspx is loaded again. The URL now shows B.aspx#test Expected Results:

Why does Twitter use a hash and exclamation mark in URLs, and how do they rewrite search URLs?

非 Y 不嫁゛ 提交于 2019-11-27 21:04:09
We understand the hash is for AJAX searches, but the exclamation mark? Anyone know? Also, the "action" attribute for their search form points to "/search," but when you conduct a search, the hash exclamation mark appears in the URL. Are they simply redirecting from "/search" to "/#!/search"? Note: the second part of the q remains unanswered: That is, are they redirecting the user from "/search" to "/#!/search", or do they send the user to "/search" and use JS on the page to rewrite the URL? – Crashalot Jan 26 at 23:51 Thanks! To answer the second part then: It is redirecting you to /#!/search.