Scroll to div on another page in React - javascript

I'm doing a React project and I want to redirect to #categories div on main page...when I click on a link on navbar of the main page (where #categories div is) it works, but when I click on that link on another page (categories div is on another page and it should redirect me to localhost:3000/#categories), the href is good but it only redirects me to that page, not to categories div on the page.
I have tried writing a function to do it and also checked if the div name (id) is correct, checked if link works and everything.
Does anyone know how to solve this?
Thank you.

You cannot redirect to a div instead use section tag
<section id="categories">
<div></div>
</section>
Now the same localhost:3000/#categories href would work. Read More

Related

Manipulating page bookmark position

I'm using Bootstrap to create a single page portfolio, I'm using bookmark links to navigate the page, however I want the page to land earlier than the position it lands on, I am pointing to the div I assigned the Id to it. is there anyway to do it?
Let's say, you want to go to footer on click of Goto Footer link
Goto Footer
Then, the footer block should have
<div id="footer-block">Page Footer</div>

How to scroll and load a hidden id at the same time

My problem goes like this.
I have a tab on the left side and the content for each tab shows in the right side.the tab extends long way down so I should use page scroll to get bat to the top in order or the content to be viewed but I cant scroll and load the same time.
So whats happening is I need to double click the tab to load and scroll to the id to the top.can someone help me with this?
perhaps you could wrap the tabs in an anchor tag with href: and wrap the content in a div tag with the id <div id="content"></div>, this way, when you click on the tab it will redirect you to the content div without having to scroll yourself.

Redirect and scroll to specific content

hi guys can any one have idea whenever i click from footer link a new page will be open and the will scroll to a specific content below is the screen shot. Condition is the website is in yii framework and nothing others.
You can create an anchor in your HTML with <a id="some-content"></a> and change the location to some/action#some-content.
using <a> you can create that functionality
<a id="travel">Travel Privileges</a>
and try to add #travel in the location bar
Ex:
http://somedomain/privileges#travel

content not loading in facebox

I'm having some trouble with facebox and can't seem to find the solution. Anyways, I have everything displayed properly and the images work but my content will not load. When you click the link with the rel="facebox" tag it shows the box but it only displays the loading.gif and none of my content. Does anyone know what is causing this? It is probably something extremely simple but I can't seem to find it in my code. Here is the link to the page: http://www.mcallaro.com/smc/contact.html. Currently I have the content being display:block so you can see it is there but once you close it and click the contact button you will see my issue.
Thanks
I haven't used facebox before, however this is most likely your problem:
<li>Contact Us</li>
Your contact link is directing to no where because it has the # symbol with no additional text. The link for facebox works similarly to anchor linking. To make it work you must direct the link to a div within the page. For example:
Your link would look like this:
Contact Us<!-- #contact is the id of the div you are linking to -->
Your div within the same page would look like this:
<div id="contact">
<!-- Your content here -->
</div>
As of right now your link goes no where and you have your contact info within a div with a class name of content.
You actually don't have to have a separate contact us page either. just simply put the contact div within every page your going to have the link and by default it would be hidden until the contact link is clicked.

Link open left div

i have this link http://www.tgi.com.pt/link/tabSlideOut.html
and my idea is the link content open the left div.
But I can't doing the desired effect
any suggestion?
Oh, i see -- you want the Content link to open the Contact thing. Well, I see your Content link (in footer (which is actually more of a header)) is:
<a id="handlee" href="#">Content</a>
so, that doesn't seem like it would ever do anything.
You do have another Content link down below, but that appears to be incorrectly included in your slide_out_div. Perhaps that Content link is supposed to be up above in the footer section where the other Content link is?

Categories