Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

enlarge div on mouseover

Posted on 2006-06-21
5
Medium Priority
?
2,193 Views
Last Modified: 2010-05-18
I have a <div> element with an image inside of it.  The div is set for 50% width and 10% height.  The image also currently shrinks or expands as you resize the window.  What I want it to do.  Is increase to 70% width and 25% height when you move the mouse over the <div> then shrink back onmouseout.  Any ideas?

0
Comment
Question by:johnywhite
  • 2
  • 2
5 Comments
 
LVL 36

Accepted Solution

by:
Zyloch earned 1000 total points
ID: 16952964
Hi johnywhite,

Do you mean:

<div style="width:50%; height: 10%; border: 1px solid black;" onmouseover="this.style.width='70%'; this.style.height='25%';" onmouseout="this.style.width='50%'; this.style.height='10%';">Testing</div>

Regards,
Ted
0
 

Author Comment

by:johnywhite
ID: 16956440
Is there anyway to make it overlap other elements without setting the position absolutely?
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 16956458
Not that I know of. z-index works with both position absolute and position relative, but relative positioning keeps the object inline with the document so it will always create more space for it as it expands.
0
 
LVL 2

Assisted Solution

by:mazzachre
mazzachre earned 1000 total points
ID: 16982967
Eventually you could:

function show_bigger() {
  document.bigger.style.top = mouse.y;
  document.bigger.style.left = mouse.x;
  document.bigger.style.display = block;
}

<div id="bigger" style="display:none; width:70%; height:25%; z-index:10;">

<div style="width: 50%; height: 25%;" onmouseover="show_bigger()">

Or place them at the same place and don´t move "bigger" with the mouse
0
 

Author Comment

by:johnywhite
ID: 17025394
They will work well enough for what I need thanks.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

877 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