I am about to create a page that has a list to the left and the actual content to the right. When the user clicks on one of the items in the list, the item should turn yellow and an arrow should point to the right. The arrow will partially be outside the list panel. Se picture below.
I have thought about creating the arrow with HTML5 canvas element, is that the right way? How do I get the arrow to go over the panels border?
You are better off doing this with background images, or perhaps a bit of CSS3. Don’t use canvas, as it’s not as well supported and is overkill. If you can post your markup and the appropriate image, we can help finish it off. Read this for guidance on how to post a useful code sample:
I do not have any picture for the arrow. Do I need a special type of picture to be able to dynamically change the height of it? I do not think I will know the height of the list item before rendering the page.
At this stage, my advice would be to lock down the exact requirements and possible scenarios that the code will need to deal with. It’s a recipe for misery to approach coding without knowing exactly what you’re dealing with.
Then I have to wait. The project is just in the beginning and we have just got some basic layout samples. I thought that this arrow could be a problem and wanted to look into a solution now when I have the time.
Thanks for your time. I may return when I have more information.
Yep, definitely a good strategy. Bear in mind that it’s harder to do if the height of those list items will vary—assuming you must have the arrow. But there are workarounds, such as having a smaller arrow that is centered and is always the same height, no matter how tall the list item is … though that might look a bit odd.
I may return when I have more information.
Definitely do that. There are lots of CSS enthusiasts here who will be happy to help.