You can do both using Pure Javascript and jQuery for what I’ve seen in your project you’re already using jQuery so I set an example for you using jQuery because the code is simpler.
HTML
<div id="menu" class='source'>
<ul>
<li><a href="#contato" class='menu'>contato</a></li>
<li><a href="#quemsomos" class='menu'>quemsomos</a></li>
<li><a href="#redessociais" class='menu'>redessociais</a></li>
<li><a href="#teste" class='menu'>Teste</a></li>
</ul>
</div>
<div id="contato" class='source'><h2>contato</h2></div>
<div id="quemsomos" class='source'><h2>quemsomos</h2></div>
<div id="redessociais" class='source'><h2>redessociais<h2></div>
<div id="teste" class='source'><h2>Teste<h2></div>
CSS
.source{
position:absolute;
width:150px;
height:150px;
}
#contato{
left:50px;
top:300px;
background:#f00;
}
#quemsomos{
left:1500px;
top:500px;
background:#0f0;
}
#redessociais{
left:600px;
top:2000px;
background:#00f;
}
#teste{
left:500px;
top:700px;
background:#cccccc;
}
Javascript
$(document).ready(function(){
$(".menu").on("click",function(e){
// Pega as dimensões da janela
var W = $(window).width();
var H = $(window).height();
// Pega as coordenadas e dimensões do elemento
var elem = $($(this).attr("href"));
var x = elem.position().left;
var y = elem.position().top;
var h = elem.height();
var w = elem.width();
// Calcula as coordenadas que a tela tem que ser rolada para centralizar o elemento
x -= W/2 - w/2;
y -= H/2 - h/2;
$("body").animate({scrollTop:y,scrollLeft:x},400,"swing",function() {
var x = $("body").scrollLeft();
var y = $("body").scrollTop();
$("#menu").css({top:y,left:x});
});
e.preventDefault();
})
})
Example link in jsfiddle
I took the liberty of looking at the code of your website and saw that the DIV
that receives the content is the #ib-main-wrapper
following the example I’m posting you will have to replace the $("body")
of the animation by its div that receives the content $("#ib-main-wrapper")
Credits to editing by @Luizvieira for collaboration in the solution.
It has nothing to do with the question but: On the post-it that the noise music on the bed is written deck on the bed* at the bottom. After q see I delete the comment.
– Caputo
I found the question very interesting, mainly by the interaction mechanism that you’re designing for the site. A curiosity: by chance your project considers that a large part of the public will use mobile devices with touch interaction (touchscreen)? I ask this because from a usability point of view I believe that there are no visual indications of the continuity of space and, strictly from the desktop environment point of view, the "click and drag" seemed tiring. Maybe this is even a hook for one or two other questions... I think UX questions are missing around here. :)
– Luiz Vieira
Luiz, the site was not really made for mobile, just for desktop, the concept of dragging is only a secondary option because when the site is complete it will load directly into the central content with the menu above. And the idea is that the person sees that they have more things to the side and click on the menu to see them. If I could change some things but you know how it is customer
– user4451
Yes, I had understood this dynamic of the question itself. Still, I suggest you do some evaluations with potential users to collect feedback. Depending on what THEY say, I think your client is able to hear.
– Luiz Vieira