anchor

Is There an Alternative Method to Mimic the Behavior of an Anchor Link/Target Pseudo-Class?

我与影子孤独终老i 提交于 2019-11-26 18:40:45
问题 Original Post: Is it possible for onclick within an <a> tag to call an anchor link, just as href does? In the snippet below, I have <a href="#view"> applied to all images, and <a id="close-customlightbox" class="lb-animate" href="#!"> as a return URL once each image is closed from lightbox view. Ideally, I would rather have the anchors prompted where they would not create any sort of extension to the page's URL. So after clicking <a href="#view"> , it adds on to the page's URL like so: http:/

CSS: pure CSS scroll animation

孤街醉人 提交于 2019-11-26 18:18:31
I have been looking for a way to scroll down when clicking on a button that is located on top of a page using CSS3 only. So I've found this tutorial: http://tympanus.net/codrops/2012/06/12/css-only-responsive-layout-with-smooth-transitions/ Demo: http://tympanus.net/Tutorials/SmoothTransitionsResponsiveLayout/ But it's a bit too advanced for my needs since I just want the browser to scroll down on a click on one button located on top of the page, so I was wondering: is it possible to do those CSS scrolls without the input buttons, just with an anchor tag? HTML looks like this: <a href="#"

Making href (anchor tag) request POST instead of GET? [duplicate]

拟墨画扇 提交于 2019-11-26 18:15:42
问题 This question already has an answer here: Make a link use POST instead of GET 11 answers <a href="employee.action" id="employeeLink">Employee1</a> when i click the Employee1 link, GET request goes to server. I want to make it POST instead of GET request. Is there a way i can change default GET behaviour of href? Note:- I know it can be done where we can call javascript function on hyperlink click , then create form and submit it. But i am looking where we can mention some attribute in anchor

Get anchor part of URL in controller in Ruby on Rails

倖福魔咒の 提交于 2019-11-26 17:40:31
问题 Is there a way to get the anchor part of a URL in a controller? Example: if I type http://www.foo.com/bar#anchor123 can I get the string anchor123 in my controller? 回答1: You can't do that in Rails, because the anchor is not sent to the server. See mikeduncan.com/?s=named+anchors 回答2: No sorry, it's not possible to retrieve the #anchor from the server-side (in any language). This is a client-side flag to tell the browser to move to a specific position in the page. But you can use some

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

梦想与她 提交于 2019-11-26 17:39:58
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" /> Frédéric Hamidi The src attribute should contain a valid URL . Since space characters are not allowed in URLs, you have to encode them . You can write: <img src="buttons/bu%20hover.png" /> But not : <img src="buttons/bu+hover

Using jQuery to programmatically click an <a> link

让人想犯罪 __ 提交于 2019-11-26 17:28:16
问题 I know this question has been asked before, but after a search on the web I can't seem to find a straight forward answer. the HTML <a id=myAnchor href=index.php> the jQuery (Both of these do not work) $('#myAnchor').click(); or $('#myAnchor').trigger('click'); What is the simplest and most efficient way to achieve this? 回答1: Try this: $('#myAnchor')[0].click(); It works for me. 回答2: window.location = document.getElementById('myAnchor').href 回答3: Click just triggers the click event / events

hash in anchor tags

好久不见. 提交于 2019-11-26 15:48:58
问题 How do I load a page and get it to open at a certain location of the loaded page? For example, lets say I have page1.html , which has 3 links <a href="page2.html#1">1</a> <a href="page2.html#2">2</a> <a href="page2.html#3">3</a> on page2.html , I have those links on the page also, i.e. <a href="page3.html#1">1</a> <a href="page3.html#2">2</a> <a href="page3.html#3">3</a> but when I click on the #2 or #3 link from page1.html , they always open at the top of the page, even though #2 and #3 are

How do I run PHP code when a user clicks on a link?

对着背影说爱祢 提交于 2019-11-26 14:26:59
I want to have a page run some PHP code when a user clicks on a link, without redirecting them. Is this possible with <a href=""></a> or with the javascript onclick event? Yeah, you'd need to have a javascript function triggered by an onclick that does an AJAX load of a page and then returns false, that way they won't be redirected in the browser. You could use the following in jQuery, if that's acceptable for your project: <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript"> function doSomething() { $.get("somepage.php"); return false; } </script> <a

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

北慕城南 提交于 2019-11-26 13:48:23
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? 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 applicable: a.hover:hover {text-decoration: underline; } Incidentally it may be worth pointing out that the class name

append /remove anchor name from current url without refresh

十年热恋 提交于 2019-11-26 12:56:49
问题 I want that on click event to append/remove the anchor name \"#on\" to be added to the current url without reloading the page, or use the href=\'#on\' from links because it makes my page jump Eg: http://www.example.com/page.html#on so I can get the detect the users that come from that url and call the On() function function On() { //append to current url the anchor \"#on\" } function Off() { //remove from the current url the anchor \"#on\" } $(\'.on\').live(\'click\', function() { On();