Is there any clean method to make a regular link :
<a href="[8]">Click here to read more...</a>
to act EXACTLY like a button
<button id="[8]">Click here to read more...</button>
Thanks !
Is there any clean method to make a regular link :
<a href="[8]">Click here to read more...</a>
to act EXACTLY like a button
<button id="[8]">Click here to read more...</button>
Thanks !
Do you mean something like this?
<a id="[8]" class="readmore" href="#">
Click here to read more...
</a>
Adapting your javascript to the new "a":
$("a.readmore").click(function() {
var id=this.id.split('[');
var d_id=id[1].split(']');
var ii=d_id[0] $('html, body').animate({
scrollTop: $('[id='+ii+']').offset().top
}, 2000);
return false;
});
Just a tip, your string processing looks terrible, suggestion:
$("a.readmore").click(function() {
var id=this.id.match('[0-9]+');
$('html, body').animate({
scrollTop: $('[id='+ id +']').offset().top
}, 2000);
return false;
});
Ensure this code is being intercept by the page dom parser in the right time, put it inside a
$(document).ready(function(){ ... });
Regards.
Yes that is good sir ! I hope this will satisfy your needs :).
<html>
<style>
.lnkbtn{
display: block;
width: 100px;
background-color: lightgrey;
border: 1px solid black;
text-align: center;
text-decoration: none;
padding: 5px 0px 5px 0px;
}
.lnkbtn:hover{
background-color: #aaa;
}
.lnkbtn:visited{
color: blue;
}
.lnkbtn:active{
border: 1px solid red;
}
</style>
<body>
<a href = "http://www.google.com" class = "lnkbtn">Click me!</a>
</body>
</html>