JavaScript - Javascript To Adjust Image Exposure/brightness
I'm looking to do the following in javascript. Either on image_load OR on mouseover of an image, I would like to transition the exposure (or gamma, or brightness) of the image from over-exposed, down to the regular image.
If that doesn't make sense, please see an example at: http://www.entheosweb.com/Flash/Phot...20/default.asp The coding for the example in Flash (Actionscript 3.0) is as follows: Code: function changeColor() { var colorComponent = 400; onEnterFrame = function () { myColor = new Color(big_mc_image); myColTr = new Object(); colorComponent = colorComponent + (100 - colorComponent) / 6; myColTr = {ra: colorComponent, ga: colorComponent, ba: colorComponent}; myColor.setTransform(myColTr); big_mc_image._visible = true; if (Math.round(colorComponent) == 100) { delete this.onEnterFrame; colorComponent = 400; } } ; } But as you can see, they use a built-in "TRANSFORM" function. In JAVASCRIPT, is it possible to affect the brightness/exposure of an image??? I know that alpha/opacity can be manipulated and would love to have this effect in my html/javascript code. I've attached the following code (simple fade in/fade out of an image). But would basically like to replace "OPACITY" with "EXPOSURE". Code: function fade(eid) { var element = document.getElementById(eid); if(element == null) return; if(element.FadeState == null) { if(element.style.opacity == null || element.style.opacity == '' || element.style.opacity == '1') { element.FadeState = 2; } else { element.FadeState = -2; } } if(element.FadeState == 1 || element.FadeState == -1) { element.FadeState = element.FadeState == 1 ? -1 : 1; element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft; } else { element.FadeState = element.FadeState == 2 ? -1 : 1; element.FadeTimeLeft = TimeToFade; setTimeout("animateFade(" + new Date().getTime() + ",'" + eid + "')", 33); } } I haven't come across any .js files that I can download. Know of any? Similar TutorialsHello! Please take a look at my site: Test Flyout Lists As I hover over Item 15, I want it to be like, "Okay, this list I'm about to display is going to be too long, so let's disregard the 'top: 10px' line in the CSS and instead have the submenu sit with its last item right at the bottom aligned with the bottom of the gradient." That way, we know for sure that the submenu will not reach past the height of the body, and the last item will be visible. The bottom of the last item's cell should "hug" the bottom of the page/gradient. Can I do this in JavaScript? Hey I was wondering, I have a box with tabs at the bottom. As you click the tabs, different stories appear in the box. However, I have the box in a fixed length. So if stories are longer, then they disappear beneath the visible line of the box. When I had it auto-adjusting though, the box would change based on the story I was clicking on. It gets weird. Is there a way to have the box auto-adjust based on the largest amount of text and have it stay that height regardless on what story you pick? I hope this makes sense. Thanks! KZ I have been over this code several times and through as many tutorials as I can fine and I still can not figure out why it does not work. Is anyone here able to point out my error? The objective of the code is to get the size in pixels of the viewport when the browser loads page, and when the browser window is resized. After obtaining that number I want to use it to set the size of my DIV to 770px if the viewport has gotten shorter than than 770, and to auto if my viewport is larger than 770. Note, I am not posting the HTML or CSS code because it seems like this should be simple - I will gladly post that code if it turns out my question is not simple. Code: <script language="JavaScript" type = "text/javascript"> <!-- function inspectview() { var viewportheight; // most modern browsers if (typeof window.innerWidth != 'undefined') { viewportheight = window.innerHeight; } // IE6 in standards compliant mode else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) { viewportheight = document.documentElement.clientHeight; } // older versions of IE else { viewportheight = document.getElementsByTagName('body')[0].clientHeight; if (viewportheight <= 770){ document.getElementById("bg").style.height = "770px"; } else { document.getElementById("bg").style.height = "100%"; } } window.onload = inspectview; window.onresize = inspectview; //--> </script> Thank you in advance -Alaric_ Hi people, I'm new to this and I was wondering how to adjust the iframe height by itself if my html height increases. My html code includes a facebook comment at the bottom of my page and the comment will show making it expand the height once users post comments. On the other hand, I'm using a CMS that have its own iframe. I've tried many solutions that can be found on the web but none works. It only can work if I don't put in CMS. Is it possible to adjust the iframe height using CMS or there is no way? I hope you guys understand what I'm trying to say. Hope to hear from you guys soon. Thanks alot. Hello, I'd like to make an iframe that will automatically get the height of the webpage it is on (not the source url) - I'm not talking the browser viewport but the entire document - so basically the height in pixels minus a certain value to prevent the iframe from sliding out - example: Code: <iframe src="http://google.com/" height="CURRENT DOCUMENT'S HEIGHT MINUS 50" width="FIXED"></iframe> Maybe it is better to achieve this function in php - or any other way? And perhaps there is some better way than an iframe - like a container of some sort that can automatically expand to the webpage's length... Thanks in advance! i want to adjust text size according to a page without scrollers. e.g the page should be shown that its scrollers are off and the text on the page spread from top to bottom.
I had a thread on here earlier in which one of you helped me immensely. As I mentioned in that thread, I know very little about javascript. The code I was given basically handles one user, and does it very well. I have since attended a meeting in which I was asked to have multiple users on one page. For example: My current code handles the following: Name - Hours - series of radio button choices. My updated request is the following: Name - Hours - series of radio button choices Name - Hours - series of radio button choices Name - Hours - series of radio button choices Name - Hours - series of radio button choices etc. up to 15 total users. I have tried to adjust the javascript, but with my lack of knowledge in this area I keep breaking it. Any help would again be greatly appreciated, here is my code: Code: <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Jared Daily Sales Goal Calculation Worksheet</title> </head> <script type="text/javascript"> var IE = navigator.appName == "Microsoft Internet Explorer"; var nSets = ""; var answeredQ = []; function advanceTo(nextQ,nQ){ var currAns = answeredQ[nQ.name.replace(/q/,"")-1]; if (currAns != "-" && currAns != nQ.value) { var nFloor = nQ.parentNode.parentNode.id.replace(/f/,"")-1; for (i=0; i<nSets.length; i++) { if (i > nFloor) { nSets[i].style.display = "none"; } } } nSets[nextQ-1].style.display = ""; answeredQ[nQ.name.replace(/q/,"")-1] = nQ.value; } function init(){ nSets = document.forms[0].getElementsByTagName('fieldset'); for (i=1; i<nSets.length; i++) { nSets[i].style.display = "none"; answeredQ[answeredQ.length] = "-"; } } IE ? attachEvent('onload', init, false) : addEventListener('load', init, false); </script> <style type="text/css"> body {background-color: #ffffff; margin-top: 60px;} fieldset {border: 0px} td { font-family:Arial, Helvetica, sans-serif; font-size:12px;} h1 { font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold;} </style> <body> <cfform action="" method="post"> <!--- Header ---> <table border="1"> <tr> <td> <table align="left"> <tr bgcolor="#E5E5E5"> <td>Name</td> <td>Hours</td> <td colspan="4"></td> </tr> <!--- Emp 1 ---> <tr bgcolor="#ffffff"> <td valign="top"><input name="" size="10"></td> <td valign="top"><input name="" size="10"></td> <td valign="top"> <fieldset id="f1"> <!-- Question 1 --> <label><input type="radio" name="e1q1" value="Diamond1" onclick="advanceTo(2,this)">Diamond</label> <label><input type="radio" name="e1q1" value="Perimeter1" onclick="advanceTo(3,this)">Perimeter</label> </fieldset> </td> <td valign="top"> <fieldset id="f2"> <!-- Question 2 --> |<label><input type="radio" name="e1q2" value="GM1">GM</label> <label><input type="radio" name="e1q2" value="AGM1">AGM</label> <label><input type="radio" name="e1q2" value="DDM1">DDM</label> <label><input type="radio" name="e1q2" value="FT1" onclick="advanceTo(4,this)">Full Time</label> <label><input type="radio" name="e1q2" value="PT1" onclick="advanceTo(4,this)">Part Time</label> </fieldset> </td> <td valign="top"> <fieldset id="f3"> <!-- Question 3 --> <label><input type="radio" name="e1q3" value="PDM">PDM</label> <label><input type="radio" name="e1q3" value="RL">RL</label> <label><input type="radio" name="e1q3" value="FT1" onclick="advanceTo(4,this)">Full Time</label> <label><input type="radio" name="e1q3" value="PT1" onclick="advanceTo(4,this)">Part Time</label> </fieldset> </td> <td valign="top"> <fieldset id="f4"> <!-- Question 4 --> |<label><input type="radio" name="e1q4" value="Tenured1">Tenured</label> <label><input type="radio" name="e1q4" value="NonTenured1">Under 2 Years</label> </fieldset> </td> </tr> </table> </td></tr></table> </cfform> </body> </html> Please try a search on my webpage (search box is located at top of sidebar on the left): http://www.americanchic.net/help Here is the code implemented on the search results page: Code: <div id="cse-search-results"></div> <script type="text/javascript"> var googleSearchIframeName = "cse-search-results"; var googleSearchFormName = "cse-search-box"; var googleSearchFrameWidth = 500; var googleSearchDomain = "www.google.com"; var googleSearchPath = "/cse"; </script> <script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script> The original code (from my Google custom search control panel) included a FrameWidth of 600 and I changed it to 500 but it didn't make a difference. Any ideas? I'm wondering if anyone out there has a jquery solution to using an iframe that automatically adjusts it's height of the child and also works cross domain. Any help would be greatly appreciated. Hello, I am working on a page that has a jQuery full browser BG image and I am trying to also utilize a MooTools gallery. There seems to be some interference between the two JavaScripts as only one works (whichever one is last in order in the header of the HTML document). Links: http://www.courtneyhunt.com.au/press_bg.html http://www.courtneyhunt.com.au/press_gallery.html I am a complete novice with JavaScript so if anyone could help that would be great. Thank you in advance. Hi I've searched this forum and found nothing that fits my problem. I used Gimp. I have a map that I have split up into about 5 regions that are all linked to Google for now. (links to be changed later on). I selected the JavaScript tab an then typed into the mouseover box. Here is part of the code it produces in the .map file: <area shape="poly" coords="205,32,159,34,150,83,124,122,114,154,133,175,140,199,159,222,176,217,185,214,223,194,224,173 ,231,155,235,130,224,124,215,107,213,82,212,71" alt="google" onmouseover="img src="http://i42.tinypic.com/14oc0lj.jpg"" href="http://www.google.com" /> The " bit looks wrong so I took it out and it still doesn't do anything when I mouseover. I've tried linking it to a file within my website folders as well as hosted on the internet. Any ideas please? The links work but the mouseover effect doesn't. Thanks <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <img src="C:\Documents and Settings\markp\Desktop\demo\images\mapv10.jpg" width="350" height="400" border="0" usemap="#map" /> </head> <body> <map name="map"> <!-- #$-:Image map file created by GIMP Image Map plug-in --> <!-- #$-:GIMP Image Map plug-in by Maurits Rijk --> <!-- #$-:Please do not edit lines starting with "#$" --> <!-- #$VERSION:2.3 --> <!-- #$AUTHOR:markp --> <area shape="poly" coords="205,32,159,34,150,83,124,122,114,154,133,175,140,199,159,222,176,217,185,214,223,194,224,173 ,231,155,235,130,224,124,215,107,213,82,212,71" alt="google" onmouseover="img src=C:\Documents and Settings\markp\Desktop\demo\images\mapv10b.jpg" href="http://www.google.com" /> <area shape="poly" coords="225,197,174,221,139,251,150,266,199,265,203,270,223,270,223,277,241,273,251,270,252,258,348, 249,309,179,308,178" href="http://www.google.com" /> <area shape="poly" coords="255,271,277,271,287,286,272,312,269,326,316,379,314,399,221,398,223,336,104,340,101,329,108, 319,136,305,156,301,162,303,179,304,191,305,201,299,210,283,220,277,233,277,249,273,261,271" href="http://www.google.com" /> <area shape="poly" coords="247,268,206,268,200,263,152,263,139,272,121,274,94,249,76,241,57,242,38,261,38,289,43,308,61 ,313,89,314,105,308,113,308,144,296,152,296,160,296,168,301,183,300,201,293,208,283,215,276,226,275, 250,275,252,268,224,267,203,267,201,264" href="http://www.google.com" /> <area shape="poly" coords="52,126,17,136,1,174,5,197,56,198,80,198,79,213,88,222,100,230,112,239,117,239,128,233,139,22 6,142,216,142,203,138,195,122,189,118,188" href="http://www.google.com" /> </map> </body> </html> http://www.muffettandsons.com/specproductstest.html Follow the link above and click on the pic to the right to open the pop up image gallery. For some reason the thumbs do not appear in the left preview pane until a rollover of the preview pane slide bar. This only occurs in IE. Firefox and Chrome both show the thumbs when opened and work just fine. Any help would be greatly appreciated... Thanks I need a JavaScript image changer like this: When you mouse over photo1.jpg, it will change to photo2.jpg. When you mouse over photo2.jpg it will change to photo 3.jpg and so on untill photo5.jpg. Please keep this in JavaScript form :) Hello. I am having trouble with a simple image gallery with navigational buttons including "first", "next", "previous", and "last"; and making a drop-down archive menu. 1. For the most part, the image gallery works. The problem is that when a user clicks on "next", and then "prev", the last image is not displayed. On the other hand, if a user clicks "prev", and then "next" the last image is displayed(works normally). 2. The way I am displaying the last image, the function last(), is not efficient. It simply refreshes the page in order to display the last image. Basic overview: The images follow a simple standard: page1, page2, page3,...page64; they are in a subfolder "img". The function changeImage() changes the image from the prev, to the next. The image gallery displays the last image in the gallery; when a user clicks on 'prev' it goes to the previous image, and go to the next image when clicked on 'next'. If the current image is the last image, and the user clicks on 'next', it goes to the very first image. Here is the code (in the <HEAD> tags): Code: <script language="JavaScript"><!-- which_image_loaded = -1; NUMBER_OF_IMAGES = 64; current_comic = 0; ImageNames = new Array; ImageNames.length = NUMBER_OF_IMAGES - 1; for (counter = 0; counter < NUMBER_OF_IMAGES; counter++){ file_number = counter + 1; filename = ("../img/page" + file_number + ".png"); ImageNames[counter] = filename; } function changeImage(direction) { which_image_loaded += direction; current_comic = which_image_loaded + 1; if (which_image_loaded < 0) which_image_loaded = NUMBER_OF_IMAGES - 1; if (which_image_loaded == NUMBER_OF_IMAGES) which_image_loaded = 0; if(current_comic <= 0){ which_image_loaded--; } document.myimage.src = ImageNames[which_image_loaded]; } function first(){ which_image_loaded = 0; current_comic = 1; document.myimage.src = ImageNames[0]; } function last(){ window.location='http://www.bearoncampus.com'; } and in the <BODY> tags Code: <img src="img/page64.png" alt="New comic not available." name="myimage" width="725" height="275"> <form> <input type="button" value="FIRST" onClick="first()"/> <input type="button" value="PREV" onClick='changeImage(-1);' /> <input type="button" value="NEXT" onClick='changeImage(1);' /> <input type="button" value="LAST" onclick="last()" /> </form> My guess is the code is not working properly due to the initial values of the counter. Last, is there a way to display the current image "myimage.src" using a dropdown menu with each option value as each image? I have done this with window.location, but this only redirects to the image location. Much thanks. Any help is greatly appreciated. I was wondering if it was possible to get java to display images that have the same name but diff numbers like: Soccer*** Displays; Soccer001 Soccer002 Soccer003 Soccer004 .... So on and so forth. Sorry the question isn't worded well lol Can someone point me in the right direction to making custom javascript image slideshow transitions?
I am using the JavaScript Image Scroll found on http://net.tutsplus.com/tutorials/ja...mage-scroller/. I would like to make it so that the images loop with no gap, it has a view demo on the site which you can see here; http://net.tutsplus.com/tutorials/ja...mage-scroller/ Many Thanks, Tim Please help. I am using Image Zoom JQuery script for one gift page because it is browser compatible and it works great. But they want me to add this script to the previous thumbnail page. So the thumbnails have to be a zoomable image as well as a clickable link to go to the next page. The JQuery script I can't seem to do both with but MojoZoom script you can except it does not do well in any browsers except Mozilla. It uses a data-zoomsrc to bring in the larger image. I just can't get it to work in anything but mozilla. I have tried messing with the .css and the .js file with no luck in controlling where the zoomed image falls on the page. In IE it shows way up above the thumbnail instead of directly next to the thumbnial. Please any help is appreciated. Or if you have another type of image zoom script that you are familiar with please suggest. I have seen other posts but not to do with the image being clickable and zoomable.
I am working on a simple image crossfade for my website, and i downloaded a good file folder with a javascript code that works well. it's exactly what i'm trying to achieve. yet, when i put in the code into my webpage index it doesn't fade like it should. the images fade out but don't cross-fade into each other. I tried testing the original file/script with alternate images/jpgs to see if my images were messing things up but it was fine, yet when i use MY webpage in MY root folder it doesn't work. so is there something wrong with my rootfolder that is messing up the javascript? i'm pulling my hair out because the code looks fine to me. please help! thanks!! jason http://www.javascriptkit.com/script/...2/3slide.shtml Hi i have the above image slideshow script running fine on a webpage can anybody tell me how i can get it to run a second time to show a second different slideshow on the same page? Ive tried editing variables but i cant work it out. would be much appreciated Ta |