if you sign up for a personalized home on google a few small module items will display on the page. You can then move these around by drag and drop. I wondered if anyone knows how to do this? I would be very greatful for any responses.
Thanks
if you sign up for a personalized home on google a few small module items will display on the page. You can then move these around by drag and drop. I wondered if anyone knows how to do this? I would be very greatful for any responses.
Thanks
As described, that Google-style page is just a set of small panels the user can reorder in the browser and then persist. pointed you toward a client-side approach; here is a focused, practical plan plus a tiny example you can apply immediately.
A minimal DOM pattern (one column shown) — each widget has a stable id and a visible handle:
<div id="columns">
<div class="module" data-id="weather">
<div class="handle">Weather</div>
<div class="body">...</div>
</div>
<div class="module" data-id="news">
<div class="handle">News</div>
<div class="body">...</div>
</div>
</div> Keep the drag logic separate from saving. Capture the final order and send it to your server (or use localStorage as a quick fallback). Example saver (call this from your drag-end handler):
function saveLayout() {
const ids = [...document.querySelectorAll('#columns .module')].map(el => el.dataset.id);
fetch('/saveLayout', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({order: ids})
});
}
let _saveTimer;
function scheduleSave() {
clearTimeout(_saveTimer);
_saveTimer = setTimeout(saveLayout, 300);
} Practical tips and gotchas:
scheduleSave(). z-index or pointer-events, nested anchors intercepting pointer events, and forgetting to serialize the right data-id values. Server-side: validate the incoming order and guard against tampering.This gives a small, robust template to build on: modular markup, a single save routine, and attention to accessibility and mobile.
Jump to Post— pty 882Google's interactive page was made using a technology called AJAX.
If you google for AJAX tutorials you'll find lots, there have been numerous ones on
Thanks very much for that I shall have a look at that, cheers
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.