Solved

enlarge div on mouseover

Posted on 2006-06-21
5
2,177 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 250 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 250 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now