anchor

How do I scroll an overflowed div to a certain hashtag (anchor)?

淺唱寂寞╮ 提交于 2019-12-06 22:31:11
问题 On my webpage I have an overflowed div (i.e. with the vertical scrollbar). Inside the div, I have anchors with ids. When I put one of these ids in the URL (mypage.html#id), I want the div, not the page, to scroll to that anchor. How do I do that, preferably with plain JavaScript? If it's too complex, I'll go with jQuery, but I'm not using it in this project for anything else. 回答1: $('.overflow').scrollTop($('#anchor').offset().top); There is no reason at all you can't convert this to standard

CSS: a:link vs just a (without the :link part)

社会主义新天地 提交于 2019-12-06 18:20:57
问题 So we're required to use the following order for CSS anchor pseudo-classes a:link { color: red } a:visited { color: blue } a:hover { color: yellow } a:active { color: lime } But my question is why bother with the a:link part? Rather, is there any advantage to the above (other than perhaps clarity) over: a { color:red; } /* notice no :link part */ a:visited { color: blue; } etc.,etc. 回答1: :link selects unvisited links, that is: anchors with an href attribute which have not been visited by the

Flask redirect url with anchor

一个人想着一个人 提交于 2019-12-06 18:02:46
问题 I have some problem with redirecting with anchors from python code. My code: func(): ... redirect(url_for('my_view', param=param, _anchor='my_anchor')) This redirect didn't redirect me to #my_anchor. In template link like: <a href="{{ url_for('my_view', param=param, _anchor='my_anchor') }}"></a> works good... May be problem in flask function "redirect". How I can use redirect with anchors in Flask? Flask version 0.10.x 回答1: if your goal is to be redirected to a page with an anchor preselected

Stop jquery TABS from jumping / scrolling up when clicked on?

帅比萌擦擦* 提交于 2019-12-06 13:24:00
The engine I use calls the jquery tabs.js script to handle the tab functions. Problem is that anytime the tabs are at the top of the page and you click on a link, they quickly scroll back down towards the bottom of the page. I've been trying to solve this problem for hours and all solutions point to similar answers, but none work for me. $.fn.tabs = function() { var selector = this; this.each(function() { var obj = $(this); $(obj.attr('href')).hide(); $(obj).click(function() { $(selector).removeClass('selected'); $(selector).each(function(i, element) { $($(element).attr('href')).hide(); }); $

How to use text-input to go to anchor?

不羁的心 提交于 2019-12-06 12:12:04
问题 I want to use jQuery to go to an anchor with the use of a textbox, for example, I want to use this form: <form id="gotoanchorform"> <input id="gotoanchorinput" type="text" /> <input type="submit" value="Go to anchor" /> </form> In this form I would type the name of the anchor and when I click the "Go to anchor" button or press the enter key I want the page to scroll down to that anchor: <a name="targetAnchor" id="targetAnchor">Target</a> How would get this to work with jQuery? 回答1: var anchor

jQuery stopPropagation not working when applied to textbox inside anchor

こ雲淡風輕ζ 提交于 2019-12-06 10:42:47
hope you can help me. I have html markup like this: <a href="error.htm" class="button" id="_uiStart" style="-moz-border-radius: 4px 4px 4px 4px;"> <span>Start</span> <input type="text" id="_uiCode"> </a> Normaly, when user clicks on the textbox, the page redirects to "error.htm". I wanted to prevent that so I use jQuery to cancel that: $(document).ready(function() { var mute = function(event){ event.stopPropagation(); }; $('a.button input').click(mute) .mousedown(mute) .mouseup(mute); } However, this does not work, the click still gets processed by anchor and redirects to "error.htm". Please

Retain anchor when redirecting subdomain (IE)

好久不见. 提交于 2019-12-06 10:23:27
问题 Firefox: http://example.com/about/#anchor -> http://www.example.com/about/#anchor Internet Explorer 6-8: http://example.com/about/#anchor -> http://www.example.com/about/ Why is the anchor dropped in IE and what can I do about it? (Query string is not dropped, only the #xyz part) Is a PHP header or javascript redirect my only option? Thanks for all hints. Update: Seems as the hash is not sent to the server. Would combining a PHP 301 header and a javascript redirect (with the location.hash) be

How to open html file with anchor(#) in C# with default browser

徘徊边缘 提交于 2019-12-06 09:14:56
I am trying to open a contextual help file in c#. When i specify no anchor, it works perfectly. Process.Start("C:/Help/Help.htm") But when i specify anchor, it does not open Process.Start("C:/Help/Help.htm#_Toc342057538") Internally it changes '#' to '%23' and the path becomes "c:\Help.htm%23_Toc342057538" which browser is unable to recognize. Browser is successfully opening the path "c:\Help.htm#_Toc342057538" How to stop this automatic conversion by Process.Start . The same behavior is observed, if i give the anchor label as another argument, or use Uri class. EDIT Same behavior is observed,

CSS word-wrap: break-word not wrapping a tag unless you wrap it in div and add rule there

爱⌒轻易说出口 提交于 2019-12-06 08:49:21
问题 why does CSS rule a { word-wrap: break-word; } with <div> <a href="...">verylongurlherewithnospaces</a> </div> not wrapping and causing window to show scrollbar, whereas div { word-wrap: break-word; } will do the wrapping at its anchor child's text fine? UPDATE: just noticed (see L3ST-instance URL field at this form when you resize the window) that I needed word-break:break-all instead of word-wrap:break-word, apart from the suggested display:inline-block, so now using: a { word-break: break

Adding attributes to an anchor in Wordpress

泄露秘密 提交于 2019-12-06 07:45:45
I want to add custom attribute settings to a generated anchor link of Wordpress. This is to let Jquery Mobile find the attributes and makes a button out of it. Every anchor link, which is generated in Wordpress via PHP, contains the page_item class. So my guess is to search for the needed 'page_item' class and just add the needed attribute information to generate the needed button. My header.php file contains the following links to the needed Jquery libraries: <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" /> <script src="http://ajax.googleapis