By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,317 Members | 1,297 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,317 IT Pros & Developers. It's quick & easy.

Expand image from slide show

idsanjeev
100+
P: 241
Hi
i have some image in slide show on load events. i wants to expand image on mouseover from slide show.
thanks
May 26 '08 #1
Share this Question
Share on Google+
22 Replies


gits
Expert Mod 5K+
P: 5,390
on mouseover just set the size and with of the currently hovered image ... post the code you have done so far.

kind regards
May 26 '08 #2

idsanjeev
100+
P: 241
on mouseover just set the size and with of the currently hovered image ... post the code you have done so far.

kind regards
Hello gits
code of fade image is work but i wants to on mouse over the image is expanded

Expand|Select|Wrap|Line Numbers
  1.  
  2. <script language="javascript" type="text/javascript">
  3. <!-- Begin
  4. // Set slideShowSpeed (milliseconds)
  5. var slideShowSpeed = 1500;
  6. // Duration of crossfade (seconds)
  7. var crossFadeDuration = 3;
  8.  
  9. var Pic = new Array();
  10. // to add more images, just continue
  11. // the pattern, adding to the array below
  12.  
  13. Pic[0] = 'images/photo1.jpg'
  14. Pic[1] = 'images/photo2.jpg'
  15. Pic[2] = 'images/photo3.jpg'
  16. Pic[3] = 'images/photo4.jpg'
  17. Pic[4] = 'images/photo5.jpg'
  18. Pic[5] = 'images/photo6.jpg'
  19. Pic[6] = 'images/photo7.jpg'
  20. Pic[7] = 'images/photo9.jpg'
  21. Pic[8] = 'images/photo10.jpg'
  22. Pic[9] = 'images/photo11.jpg'
  23.  
  24. // do not edit anything below this line
  25. var t;
  26. var j = 0;
  27. var p = Pic.length;
  28. var preLoad = new Array();
  29. for (i = 0; i < p; i++) {
  30. preLoad[i] = new Image();
  31. preLoad[i].src = Pic[i];
  32. }
  33. function runSlideShow() {
  34. if (document.all) {
  35. document.images.SlideShow.style.filter="blendTrans(duration=2)";
  36. document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
  37. document.images.SlideShow.filters.blendTrans.Apply();
  38. }
  39. document.images.SlideShow.src = preLoad[j].src;
  40. if (document.all) {
  41. document.images.SlideShow.filters.blendTrans.Play();
  42. }
  43. j = j + 1;
  44. if (j > (p - 1)) j = 0;
  45. t = setTimeout('runSlideShow()', slideShowSpeed);
  46. }
  47. window.onload=runSlideShow;
  48. //  End -->
  49.  
  50.  
  51. </script>
  52.  
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. <div style="position:absolute; top:0; left:0 ">
  4. <img src="images/photo9.jpg" name='SlideShow' border="5px" style="border-color:#B812A7 " width="170PX"  height="140PX" title="Barauni Refinry">
  5.  
  6. </div>
  7.  
thanks
May 26 '08 #3

gits
Expert Mod 5K+
P: 5,390
let me give you an example:

[HTML]<html>
<script type="text/javascript">
function zoom_in(ele) {
ele.style.width = '400px';
ele.style.height = '400px';
}
</script>

<body>
<img src="image.gif" onmouseover="zoom_in(this);">
</body>
</html>
[/HTML]
kind regards
May 26 '08 #4

idsanjeev
100+
P: 241
Hello gits
Thanks it works fine
i am usinng some frame so i wants to open it in popupwindow on mouseover and onmouse out close popup becouse size of frame where image fadein is very short its maximum width is 170px .

thanks
May 27 '08 #5

gits
Expert Mod 5K+
P: 5,390
do you have a solution, or are you asking for one? in that case use window.open() in the shown function and append an image element with a src to the greater image to it ... on mouseover just use window_ref.close() ...

the better solution would be to use an inline div or google for lightbox in case you wnat to have some out of the box fancy stuff ...

kind regards
May 27 '08 #6

idsanjeev
100+
P: 241
i have solution of window.open() on mouseover and but i cant understands how can image show thats fade in

Expand|Select|Wrap|Line Numbers
  1.  
  2. new_window.document.open();
  3.  
  4. // Text of the new document
  5. // Replace your " with ' or \" or your document.write statements will fail
  6. new_window.document.write("<html><title>JavaScript New Window</title>");
  7. new_window.document.write("<body bgcolor=\"#FFFFFF\">");
  8. new_window.document.write("This is a new html document created by JavaScript ");
  9. new_window.document.write("statements contained in the previous document.");
  10. new_window.document.write("</body></html>");
  11.  
  12. // close the document
  13. new_window.document.close(); 
  14. }
  15.  
May 27 '08 #7

idsanjeev
100+
P: 241
hello
I think i couldn't expalin clearly whats my need.
lets try to explain
i have four frame top,left,cetner and right
some images are display at right frame in fader
my needs onmouseover open a popup window and expand the image
i have code for popupwindow but havn't idea how to display image thats in fader
thanks
May 28 '08 #8

gits
Expert Mod 5K+
P: 5,390
i'm not really sure that i get it ... are you looking for something like this:

in your image's onmouseover use:

Expand|Select|Wrap|Line Numbers
  1. onmouseover="zoom_window(this);"
  2.  
i assume your function now uses the code you posted above and now gets the ref to the currently clicked image passed to it. so you could use something like the following now:

Expand|Select|Wrap|Line Numbers
  1. function zoom_window(ref) {
  2.     // some of your code 
  3.     new_window.document.write('<img src="' + ref.src + '"/>');
  4.     // more of your code
  5. }
kind regards
May 28 '08 #9

hsriat
Expert 100+
P: 1,654
If I can jump into this, may I know if the OP wants something what happens in yahoo mail (the new one) when you click on an attachment image?
May 28 '08 #10

idsanjeev
100+
P: 241
Hi gits
here is my code which works thats i wnats to do

Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2. //Function to open PopupWindow and Close PopupWindow
  3. function new_window(){
  4.     new_window = open('fader.asp','new','width=500,height=450,left=10,top=10');
  5. }
  6.  
  7. function close_window() 
  8. {
  9. new_window.close();
  10. }
  11.  
  12. </script>
  13.  
  14. <div style="position:absolute; top:0; left:0 ">
  15.  
  16. <!--
  17. Link for opne popup wondow 
  18. <a onmouseover="window.open('fader.asp','Popup_Window','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=475px,height=420px,top=30,left=20')"  >
  19. -->
  20.  
  21. <img src="images/1.jpg" id="new" onMouseOver="new_window()" onMouseOut="close_window()" name='SlideShow' border="5px" style="border-color:#B812A7 " width="170PX"  height="140PX"  title="Click to Magnifying Image">
  22. <!--</a>-->
  23. </div>
But when first time mouse over on image popup window is opend and onmouseout closed but not more without page refresh means it works only one time when mouse over on image after first time error is at line 21 where <img src.............>
line:-21
char:-1
error:-the callee[server[not server application]]is not available and disappeared; all connection are invalid. the call did not execute.

I am creating link onmouseover image window is open but it not close on mouseout
I try with these two to open new window onmouseover and close on mouseout
thanks
May 29 '08 #11

idsanjeev
100+
P: 241
Hi this code is working for me

Expand|Select|Wrap|Line Numbers
  1. <script language="javascript"> 
  2. //Function to open PopupWindow and Close PopupWindow 
  3.  
  4. function   new_window() { 
  5.   my_window = window.open('fader.asp','new','width=500,height=450,left=10,top=10'); 
  6.   } 
  7.  
  8. function close_window() { 
  9.   my_window.close(); 
  10.   } 
  11.  
  12. </script>
  13.  
Happy codding
Thanks
May 30 '08 #12

idsanjeev
100+
P: 241
Hi
I wants use open image in new winow mouseover on which but can't success

Expand|Select|Wrap|Line Numbers
  1. <scripts laguage="javascrpts">
  2. function new_window(ImageURL) { 
  3. my_window = window.open(ImageURL, 'new', 'width=500,height=450,left=10,top=10'); 
  4.   } 
  5. function close_window() { 
  6.   my_window.close(); 
  7.   } 
  8. </script> 
  9. <div id="new" style="position:absolute; top:0; left:0 "> 
  10. <img src="images/1.jpg"  onMouseOver="new_window('images1/1.jpg')"  onMouseOut="close_window()" name='SlideShow' border="5px" style="border-color:#B812A7 " width="170PX"  height="140PX"  title="Magnifying Image"> 
  11.  
  12. </div>
May 30 '08 #13

gits
Expert Mod 5K+
P: 5,390
you have some errors in your code, fix the type in javascript-tag, the script-tag itself etc. write the event-handlers all lowerCase -> for example onmouseover ...

[HTML]<script type="text/javascript">
function new_window(ImageURL) {
my_window = window.open(ImageURL, 'new', 'width=500,height=450,left=100,top=100');
}
</script>
<div id="new" style="position:absolute; top:0; left:0 "> <img src="images/1.jpg" onmouseover="new_window('images1/1.jpg')" name='SlideShow' border="5px" style="border-color:#B812A7 " width="170px" height="170px" title="Magnifying Image">
</div>
[/HTML]
kind regards
May 30 '08 #14

hsriat
Expert 100+
P: 1,654
Hi
I wants use open image in new winow mouseover on which but can't success

Expand|Select|Wrap|Line Numbers
  1. &lt;scripts laguage="javascrpts"&gt;
  2. function new_window(ImageURL) { 
  3. my_window = window.open(ImageURL, 'new', 'width=500,height=450,left=10,top=10'); 
  4.   } 
  5. function close_window() { 
  6.   my_window.close(); 
  7.   } 
  8. &lt;/script&gt; 
  9. &lt;div id="new" style="position:absolute; top:0; left:0 "&gt; 
  10. &lt;img src="images/1.jpg"  onMouseOver="new_window('images1/1.jpg')"  onMouseOut="close_window()" name='SlideShow' border="5px" style="border-color:#B812A7 " width="170PX"  height="140PX"  title="Magnifying Image"&gt; 
  11.  
  12. &lt;/div&gt;
it open only one image images/1.jpg but my needs to open thats image mouse overon which from slide
thanks
Declare my_window as a global variable in the start of the JavaScript.
When your new_window function is done, the local variable my_window is getting deleted. So the closing function doesn't work.
Remove language attribute from script tag, use type attribute instead (type="text/javascript").
Use onmouseover instead of onMouseOver. Its not VB script.
And follow as gits suggested.

And I asked you here about the problem but you didn't reply, so there was no need of PM.

Regards,
Harpreet
May 30 '08 #15

gits
Expert Mod 5K+
P: 5,390
hi idsanjeev,

don't PM experts, mods or admins regarding your problems unless your are told to do so! consider this a friendly warning by not considering this you risk a formal warning and at least this could result in a temporary ban ... read this guideline ...

kind regards
MOD
May 30 '08 #16

idsanjeev
100+
P: 241
ok, i remember it
thanks
May 30 '08 #17

hsriat
Expert 100+
P: 1,654
ok, i remember it
thanks
But you didn't tell if that thing worked for you or not.
May 30 '08 #18

idsanjeev
100+
P: 241
i cant understand thats you wnats to tell hsriat

butt sorry if any guideline had been broken by me

my internet connection is failled so after connecting i am giving
i think i am not able to clear my question
actually the working for new window

but i wants instead of fader.asp open image from slide show mean open window with image mouse over on thats

Expand|Select|Wrap|Line Numbers
  1. <img src="images/1.jpg"  onMouseOver="new_window()"  onMouseOut="close_window()" name='SlideShow' border="5px" style="border-color:#B812A7 " width="170PX"  height="140PX"  title="Magnifying Image">
thanks
May 30 '08 #19

hsriat
Expert 100+
P: 1,654
Ok, read the following stuff very carefully now.
  • The first argument of window.open should be the link (url) to the page which you want to open. Page, in your case is your image. So provide complete link of the image in that attribute.
  • In your function new_window(), you have an argument. According to your function, this needs to be the same argument which you have to give to the window.open function. So again, it should be the complete valid link to the image you want to open.
  • When you have a function with local variables in it, you can't access those local variables outside that function. If you need to do that, you have to declare them as global variables.

So modify these things in your page:
First:
Expand|Select|Wrap|Line Numbers
  1. onmouseover="new_window(this.src)
this.src will refer to the link of the image.
Second:
Expand|Select|Wrap|Line Numbers
  1. <scripts type="text/javascript">
  2. var my_window;
This will declare my_window as global variable.
May 30 '08 #20

hsriat
Expert 100+
P: 1,654
Don't tell me to explain this in Hindi now.
May 30 '08 #21

idsanjeev
100+
P: 241
i try to do like
link
but slide show starts onload and picture expand onMouseOver
thanks
May 30 '08 #22

hsriat
Expert 100+
P: 1,654
You followed nothing what was said by gits and then me.
What do you want to be improved in this page?

Note: Doctype contains a sign of exclamation ( ! ) in the starting.
<!doctype ...... >
May 30 '08 #23

Post your reply

Sign in to post your reply or Sign up for a free account.