Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack Thread Tools
Old May 23rd, 2008, 02:01 PM   #1
New Member
 

Join Date: Feb 2008
Location: Earth
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 benreynolds4 is on a distinguished road
2 ondblclick handlers to zoom-in/zoom-out images

hello everyone -

i am having difficulty with this one.
I want to enlarge/reduce (zoom-in/zoom-out) an image, but i don't want the classic ondblclick=enlarge and onclick=reduce i would like two instances of ondblclick=enlarge so ::::

ondblclick=enlarge
ondblclick=reduce
!!

is it even possible and what is the function script for it.
below is my code now.

Code:
<SCRIPT LANGUAGE="JavaScript">
function enlargeImage1(){image1.height="600"} function dropImage1()
</script>



<img src="03_pictures/image.jpg" height="200" name="image1" onDblClick="enlargeImage1()" onClick="dropImage1()">

the reason i want this is because i am trying to make my images dragable with the onclick, englarging/reducing with the dblclick and captions with the mouseover - crazy!!!

hope you can help!

ben

Last edited by CloudedVision; May 23rd, 2008 at 03:12 PM.. Reason: Code tags and signature
benreynolds4 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old May 23rd, 2008, 02:55 PM   #2
Most Reputable Member
 

Join Date: Feb 2008
Location: In My Own Little World
Age: 16
Posts: 1,345
Blog Entries: 9
Thanks: 2
Thanked 45 Times in 45 Posts
Rep Altering Power: 0 CloudedVision is on a distinguished road
Re: 2 ondblclick handlers to zoom-in/zoom-out images

try something like this:

Code:
var enlarged = false;
function switcheroo() {
   if(enlarged) {
      reduce();
      enlarged = false;
   } else {
      enlarge();
      enlarged = false;
   }
}
Then just run the switcheroo function (or whatever you decide to name it) in ondblclick. You'll have to edit it to work with your code, however. Oh, and this won't work with more than one image.
__________________
Theron Luhn
CloudedVision is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old May 23rd, 2008, 03:01 PM   #3
New Member
 

Join Date: Feb 2008
Location: Earth
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 benreynolds4 is on a distinguished road
Re: 2 ondblclick handlers to zoom-in/zoom-out images

hmm.m... well it would be great if this could work with individual image (more than one)....

hmm... shame.... well i will keep trying...if you have any other ideas, let me know..


ben

Last edited by CloudedVision; May 23rd, 2008 at 03:10 PM..
benreynolds4 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old May 23rd, 2008, 03:15 PM   #4
Most Reputable Member
 

Join Date: Feb 2008
Location: In My Own Little World
Age: 16
Posts: 1,345
Blog Entries: 9
Thanks: 2
Thanked 45 Times in 45 Posts
Rep Altering Power: 0 CloudedVision is on a distinguished road
Re: 2 ondblclick handlers to zoom-in/zoom-out images

If you want it to be done with multiple images use this:

Code:
var enlarged = new Array();
function switcheroo(src) {
   if(enlarged[src]) {
      reduce();
      enlarged[src] = false;
   } else {
      enlarge();
      enlarged[src] = true;
   }
}
then just do this: ondblclick="switcheroo(this.src);"

Again, you'll have to edit it to work with your code.
__________________
Theron Luhn
CloudedVision is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old May 23rd, 2008, 03:39 PM   #5
New Member
 

Join Date: Feb 2008
Location: Earth
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 benreynolds4 is on a distinguished road
Re: 2 ondblclick handlers to zoom-in/zoom-out images

oh great thanks...

so i am not so sure how it should be

here's a base

--------------------------------------------------------
Code:
<!--  ORIGINAL ENLARGE IMAGE-THUMBNAILS SCRIPT -->
<SCRIPT LANGUAGE="JavaScript">
function enlargeImage1(){image1.height="600"} 
function dropImage1(){image1.height="200"}

//then with your addition
var enlarged = new Array();
function switcheroo(src) {
   if(enlarged[src]) {
      reduce();
      enlarged[src] = false;
   } else {
      enlarge();
      enlarged[src] = true;
   }
}</script>
THEN IN THE BODY..

.....

Code:
<img src="03_pictures/image.jpg" height="200" name="image1" onDblClick="enlargeImage1()" ondblclick="switcheroo()">
--------------------------------------------------------
am i on the right track!?!?



thanks
ben

Last edited by saltedm8; May 24th, 2008 at 01:17 PM.. Reason: link violation removed
benreynolds4 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Page Zoom R8515198 JavaScript 1 November 30th, 2007 09:03 AM
Scale/Zoom with AS PixelLuv Flash and ActionScript 8 March 9th, 2007 06:26 PM
image zoom and scrollbar neo007 JavaScript 0 February 14th, 2007 10:54 PM
page zoom issue with IE7 badlyDrawnToy HTML, XHTML and CSS 0 January 30th, 2007 11:57 AM
zoom and scroll danieldear Flash and ActionScript 6 July 7th, 2006 04:45 PM


Search Engine Optimization by vBSEO 3.2.0 RC8