php - Single page site url?id=1#anchor -


i have single page site on show few lines of 2 latest news on start page. when click read more link, page should scroll news section , there should read full news. scroll part/show full news ok have no idea how put them together. url format not working www.example.com?id=1#news. either not scroll or jumps news section. tx

edit: in end using data-elemid pass newsid variable ajax call. works should now.

try this:

$(function(){     var hash = window.location.hash;     if(hash != "") scrollto(hash); }); 

this check if current url has hash, if does, call scrollto() method (you should replace own scroll method).


Comments