i have 1 long index page sections , 1 contact page, problem if go contact page , want go long index page, navigation links corrputed.
this navigation:
<div class="collapse navbar-collapse"> <ul class="nav navbar-nav navbar-right"> <li><a href="#home" class="smoothscroll">home</a></li> <li><a href="#about" class="smoothscroll">studio</a></li> <li><a href="#team" class="smoothscroll">team</a></li> <li><a href="#service" class="smoothscroll">services</a></li> <li><a href="#work" class="smoothscroll">work</a></li> <li><a href="#pricing" class="smoothscroll">pricing</a></li> @*<li><a href="#contact" class="smoothscroll">contact</a></li>*@ <li>@html.actionlink("contact", "contact", "home") </li> </ul> </div>
so if go contact page, url wil be:
http://localhost:53534/home/contact
but if want go there example to: services, url:
http://localhost:53534/home/contact#service - not correct url, because correct url has be: http://localhost:53534/#service. without controller name contact.
but how manage that?
thank you
oke, tried, this:
@html.actionlink( "contact", "contact" , "home" , request.url.scheme , request.url.host , "contact" , null , null ) </li>
but again if go contact other link, this: http://localhost:53534/home/contact#pricing
i tried this:
@html.actionlink( "contact", "contact" , "home" , request.url.scheme , request.url.host , "" , null , null ) </li>
so full navigation looks this:
<div class="collapse navbar-collapse"> <ul class="nav navbar-nav navbar-right"> <li><a href="#home" class="smoothscroll">home</a></li> <li><a href="#about" class="smoothscroll">studio</a></li> <li><a href="#team" class="smoothscroll">team</a></li> <li><a href="#service" class="smoothscroll">services</a></li> <li><a href="#work" class="smoothscroll">work</a></li> <li><a href="#pricing" class="smoothscroll">pricing</a></li> <li> @html.actionlink( "contact", "contact" , "home" , request.url.scheme , request.url.host , "contact" , null , null ) </li> </ul> </div>
this newest:
<div class="collapse navbar-collapse"> <ul class="nav navbar-nav navbar-right"> <li><a href="#home" class="smoothscroll">home</a></li> <li><a href="#about" class="smoothscroll">studio</a></li> <li><a href="#team" class="smoothscroll">team</a></li> <li><a href="#service" class="smoothscroll">services</a></li> <li><a href="#work" class="smoothscroll">work</a></li> <li><a href="#pricing" class="smoothscroll">pricing</a></li> <li> @html.actionlink( "contact", "contact" , "home" , request.url.scheme , request.url.host , "contact" , null , null ) </li> </ul> </div>
but link become:http://localhost:53534/home/contact#pricing. , should be: http://localhost:53534/home/#pricing.
yes, ok, sorry that, wrong post, but:
@html.actionlink("contact", "index" , "home" , request.url.scheme , request.url.host , "contact" , null , null ) </li> contact page has without "#". "#". how omit "#"? changed first index contact, because name
as stephen muecke pointed out in comment, use overload of html.actionlink
.
@html.actionlink ( "index" , "index" , "home" , null , null , "contact" // fragment , null , null );
else use regular anchor (a
) elements in html , @url.action
. use url.action
main page , navigate further there:
<a href="@url.action("index", "home")#some_optional_hash" />
Comments
Post a Comment