I am developing a one page website with a vertical smooth scrolling jquery. In the navbar I have Home, About, Services, Gallery and Contact links that are working fine with vertical smooth scroll jquery plugin.
Now, at the bottom of my gallery section I have one sentence (paragraph) which says: If you like my work GET IN TOUCH with me for more information. "GET IN TOUCH" in the same paragraph is actually a small .png file which I want to make functional so when users click on it - it will scroll down to the contact page (just like any of the other links from my navbar that works fine).
Here is my jquery smooth scroll:
$(function () {
$('header ul a').bind('click', function (event) {
var $anchor = $(this);
$('html, body').animate({
scrollTop: $($anchor.attr('href')).offset().top + "px"
}, 1500);
/*
if you don't want to use the easing effects:
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top
}, 1000);
*/
event.preventDefault();
});
});
Here is my paragraph with GET IN TOUCH image:
<div class="getintouch">
<p class="left">If you like my work</p>
<img src="images/getintouch.png" />
<p class="right">for more information.</p>
</div>
I tried to add id="contact" to the <img>
like this:
<div class="getintouch">
<p class="left">If you like my work</p>
<img id="contact" src="images/getintouch.png" />
<p class="right">for more information.</p>
</div>
...and then I modified jquery smooth scroll like this:
$(function () {
$('header ul a, .getintouch img').bind('click', function (event) {
var $anchor = $(this);
but it's not working.
Not sure if this is possible but I would like to make this GET IN TOUCH.png to scroll down to contact. Hope you guys can help! Thanks