anchor

make an html svg object also a clickable link

我只是一个虾纸丫 提交于 2019-11-26 04:37:21
问题 I have an SVG object in my HTML page and am wrapping it in an anchor so when the svg image is clicked it takes the user to the anchor link. <a href=\"http://www.google.com/\"> <object data=\"mysvg.svg\" type=\"image/svg+xml\"> <span>Your browser doesn\'t support SVG images</span> </object> </a> When I use this code block, clicking the svg object doesn\'t take me to google. In IE8< the span text is clickable. I do not want to modify my svg image to contain tags. My question is, how can I make

href syntax : is it okay to have space in file name

醉酒当歌 提交于 2019-11-26 04:24:34
问题 it has always been my practice that when ever i use images i name them like walls_ico , bu_hover so when i give paths they go like <img src=\"images/walls_ico.ico\" /> <img src=\"buttons/bu_hover.png\" /> UNTIL now when i am on a project where users upload files... i was wondering is it okay to have spaces between file and folders name like <img src=\"buttons/bu hover.png\" /> 回答1: The src attribute should contain a valid URL. Since space characters are not allowed in URLs, you have to encode

How to generate url encoded anchor links with AngularJS?

℡╲_俬逩灬. 提交于 2019-11-26 04:21:18
问题 <a href=\"#/search?query={{address}}\" ng-repeat=\"address in addresses\"> {{address}} </a> generates links that are not url encoded if I understand correctly. What is the proper way to encode #/search?query={{address}} ? Example address is 1260 6th Ave, New York, NY . 回答1: You can use the native encodeURIComponent in javascript. Also, you can make it into a string filter to utilize it. Here is the example of making escape filter. js: var app = angular.module('app', []); app.filter('escape',

jQuery Text to Link Script? [duplicate]

纵饮孤独 提交于 2019-11-26 03:55:07
问题 This question already has answers here : How to replace plain URLs with links? (24 answers) Closed 5 years ago . Does anyone know of a script that can select all text references to URLs and automatically replace them with anchor tags pointing to those locations? For example: http://www.google.com would automatically turn into <a href=\"http://www.google.com\">http://www.google.com</a> Note: I am wanting this because I don\'t want to go through all my content and wrap them with anchor tags.

How to use &#39;hover&#39; in CSS

心已入冬 提交于 2019-11-26 03:44:03
问题 I used the code below in order to fulfill this target: When mouse hover on the anchor, the underline comes out, but it failed to work, <a class=\"hover\">click</a> a .hover :hover{ text-decoration:underline; } What\'s the right version to do this? 回答1: If you want the underline to be present while the mouse hovers over the link, then: a:hover {text-decoration: underline; } is sufficient, however you can also use a class-name of 'hover' if you wish, and the following would be equally

href overrides ng-click in Angular.js

末鹿安然 提交于 2019-11-26 03:35:47
问题 When both, href and ng-click attributes are defined: <a href=\"#\" ng-click=\"logout()\">Sign out</a> the href attribute takes precedence over ng-click. I am looking for a way to raise priority of ng-click. href is required for Twitter Bootstrap, I can\'t remove it. 回答1: You should probably just use a button tag if you don't need a uri. 回答2: This example from the angular documentation site just does href without even assigning it to an empty string: [<a href ng-click="colors.splice($index, 1)

Fixed page header overlaps in-page anchors

人走茶凉 提交于 2019-11-26 03:13:53
问题 If I have a non-scrolling header in an HTML page, fixed to the top, having a defined height: Is there a way to use the URL anchor (the #fragment part) to have the browser scroll to a certain point in the page, but still respect the height of the fixed element without the help of JavaScript ? http://foo.com/#bar WRONG (but the common behavior): CORRECT: +---------------------------------+ +---------------------------------+ | BAR///////////////////// header | | //////////////////////// header

Download attribute on A tag not working in IE

≯℡__Kan透↙ 提交于 2019-11-26 02:23:41
问题 From the following code I\'m creating a dynamic anchor tag which downloads a file. This code works well in Chrome but not in IE. How can I get this working <div id=\"divContainer\"> <h3>Sample title</h3> </div> <button onclick=\"clicker()\">Click me</button> <script type=\"text/javascript\"> function clicker() { var anchorTag = document.createElement(\'a\'); anchorTag.href = \"http://cdn1.dailymirror.lk/media/images/finance.jpg\"; anchorTag.download = \"download\"; anchorTag.click(); var

Is an anchor tag without the href attribute safe?

南笙酒味 提交于 2019-11-26 02:19:00
问题 Is it okay to use an anchor tag without including the href attribute, and instead using a JavaScript click event handler? So I would omit the href completely, not even have it empty ( href=\"\" ). 回答1: In HTML5, using an a element without an href attribute is valid. It is considered to be a "placeholder hyperlink." Example: <a>previous</a> Look for "placeholder hyperlink" on the w3c anchor tag reference page: https://www.w3.org/TR/2016/REC-html51-20161101/textlevel-semantics.html#the-a

How to get the anchor from the URL using jQuery?

走远了吗. 提交于 2019-11-26 02:05:48
问题 I have a URL that is like: www.example.com/task1/1.3.html#a_1 How can I get the a_1 anchor value using jQuery and store it as a variable? 回答1: You can use the .indexOf() and .substring(), like this: var url = "www.aaa.com/task1/1.3.html#a_1"; var hash = url.substring(url.indexOf("#")+1); You can give it a try here, if it may not have a # in it, do an if(url.indexOf("#") != -1) check like this: var url = "www.aaa.com/task1/1.3.html#a_1", idx = url.indexOf("#"); var hash = idx != -1 ? url