Solved

Overlay image arrow buttons over main image, image can be variable height

Posted on 2011-03-02
6
523 Views
Last Modified: 2012-05-11
Hi Experts,

See image attached as example of how it should look.

I want to load an image inside a DIV. It will be a JPG image in a tag like: <img src="myimage.jpg"/>, the heights and widths of images will be unknown, the next image may be larger or smaller. Also the image *cannot* be a background image for the div.

Then, I want to load left and right buttons (PNG images) with a centered height over the top of this JPG image, indented 5px.

I just have no idea how to code this, my CSS skills are limited and I'm not allowed to do this in tables or with background images. They seem to use this in jquery galleries so it must be possible.

Please help! Thanks guys

/ Tobzzz example of desired end result
0
Comment
Question by:tobzzz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 17

Expert Comment

by:selvol
ID: 35022737
http://www.huddletogether.com/projects/lightbox2/#exampleLightbox does this



Image group adds the next and previous.

Selvol
0
 
LVL 11

Author Comment

by:tobzzz
ID: 35032376
In the example you've posted the next and previous links are fixed heights from the top of the image box, not centred regardless of image height which is what I specifically need. Do you know if it's possible?
0
 
LVL 17

Accepted Solution

by:
selvol earned 500 total points
ID: 35033103
Yes, it is possible.

After downloading the file

Open the folder
Open the css folder
open lightbox.css with Notepad

Locate this line

#hoverNav{ position: absolute; top: 0; left: 0; height: 100%; width: 100%; z-index: 10; }
Replace it with this line

#hoverNav{ position: absolute; top: 40%; left: 0; height: 100%; width: 100%; z-index: 10; }

Play around with the 40% if not happy try other values like 30%
#hoverNav{ position: absolute; top: 0; left: 0; height: 100%; width: 100%; z-index: 10; }

#hoverNav{ position: absolute; top: 40%; left: 0; height: 100%; width: 100%; z-index: 10; }

Open in new window

0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 11

Author Comment

by:tobzzz
ID: 35034862
For anyone wanting to do the same thing, the code is very simple, I don't know why no CSS experts answered this one. Below is the basic code for what you need to do.

Thanks to selvol for pointing me in the right direction.

/ Tobzzz
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<style type="text/css">
	#box1	{position:absolute}	
	#box2	{position:absolute; top:45%; left:0; width:100%}
	#prevLink {left:0; float:left; padding:5px; background:#fff}
	#nextLink {right:0; float:right; padding:5px; background:#fff}	
</style>	
</head>
<body>
<div id="box1">
	<img src="image.jpg" border="0" alt="" />
	<div id="box2">
		<a href="#" id="prevLink">Prev</a>
		<a href="#" id="nextLink">Next</a>
	</div>          
</div>
</body>
</html>

Open in new window

0
 
LVL 11

Author Closing Comment

by:tobzzz
ID: 35034903
Thanks for pointing me in the right direction. This was tricky to solve myself being a novice at CSS but I got there in the end.
0
 
LVL 17

Expert Comment

by:selvol
ID: 35037832
Glad you did get it.  I am glad you learned a bit.  

My method should have worked.

By addingthe CSS to the page you overwrite any values present in the external css.
Only if you place the added CSS after the external CSS.

HAve fun.

Thank you
Your Css overwrites the external CSS.
<LINK rel=stylesheet type=text/css 
href="css/lightbox.css" media=screen>
<style type="text/css">
	#box1	{position:absolute}	
	#box2	{position:absolute; top:45%; left:0; width:100%}
	#prevLink {left:0; float:left; padding:5px; background:#fff}
	#nextLink {right:0; float:right; padding:5px; background:#fff}	
</style>	
---------------------
External Css overwrites your CSS.

<style type="text/css">
	#box1	{position:absolute}	
	#box2	{position:absolute; top:45%; left:0; width:100%}
	#prevLink {left:0; float:left; padding:5px; background:#fff}
	#nextLink {right:0; float:right; padding:5px; background:#fff}	
</style>	
<LINK rel=stylesheet type=text/css 
href="css/lightbox.css" media=screen>
-------

Open in new window

0

Featured Post

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question