JavaScript - Google News Web Element: Javascript
I started using the Google News Web Element on my website. The website for Google News Web Element is: http://www.google.com/webelements/#!/news
I want the links to open in a new window, which cannot be done with the iframe version. Their website only allows me to generate an iframe. I was told that this can be done by using the javascript version, but I have not been able to figure it out. This is their link to the documentation: http://code.google.com/apis/newssearch/newsshow/ I know very little about javascript, and have been trying to get it to work but have been unsuccessful. I want to use the Medium Rectangle size and I want the only topic to be "Swainsboro". The only modification that I want to make is for the links to open in a new window. If anyone can help me do this, it would be appreciated. This is the iframe data that was generated by the wizard: Code: <iframe frameborder=0 marginwidth=0 marginheight=0 border=0 style="border:0;margin:0;width:300px;height:250px;" src="http://www.google.com/uds/modules/elements/newsshow/iframe.html?rsz=large&format=300x250&ned=us&hl=en&q=Swainsboro&element=true" scrolling="no" allowtransparency="true"></iframe> Similar TutorialsUsing the Photoslide, GK News Image VI, as seen here tools.gavick.com/demo/ni6, however its in ID order, listed. I would like to change the order of ID to Random Order. Can you please help, what code would need changing. thank you its javascript. code below: Fx.Height = Fx.Style.extend({initialize: function(el, options){$(el).setStyle('overflow', 'hidden');this.parent(el, 'height', options);},toggle: function(){var style = this.element.getStyle('height').toInt();return (style > 0) ? this.start(style, 0) : this.start(0, this.element.scrollHeight);},show: function(){return this.set(this.element.scrollHeight);}});Fx.Opacity = Fx.Style.extend({initialize: function(el, options){this.now = 1;this.parent(el, 'opacity', options);},toggle: function(){return (this.now > 0) ? this.start(1, 0) : this.start(0, 1);},show: function(){return this.set(1);}}); // window.addEvent("load",function(){ document.getElementsBySelector(".gk_ni_6_wrapper").each(function(el){ // generowanie rdzenia var mainwrap = el; var elID = el.getProperty("id"); var $G = $Gavick[elID]; var wrap = $(elID); var mouseIsOver = false; var scrollValue = 0; // var addWidth = $E("div",el).getStyle("padding-left").toInt() + $E("div",el).getStyle("padding-right").toInt() + $E("div",el).getStyle("margin-right").toInt(); // el.setStyle("width",(el.getStyle("width").toInt() + addWidth) + "px"); // $G["actual_slide"] = -1; $G["actual_anim"] = false; $G["actual_anim_p"] = false; // var slides = []; var contents = []; var pasek = false; // if(window.ie && $E(".gk_ni_6_text_bg", wrap)) $E(".gk_ni_6_text_bg",wrap).setOpacity($G["opacity"].toFloat()); // wrap.getElementsBySelector(".gk_ni_6_slide").each(function(elmt,i){slides[i] = elmt;}); slides.each(function(el,i){if(i != 0) el.setOpacity(0);}); // if($E(".gk_ni_6_text_bg", wrap)){ var text_block = $E(".gk_ni_6_text_bg",wrap); $ES(".gk_ni_6_news_text",wrap).each(function(el,i){contents[i] = el.innerHTML;}); } // animacje var amount_c = contents.length-1; if($E(".gk_ni_6_text", wrap)) $E(".gk_ni_6_text",wrap).innerHTML = contents[0]; // var loadedImages = ($E('.gk_ni_6_preloader', wrap)) ? false : true; // if($E('.gk_ni_6_preloader', wrap)){ var imagesToLoad = []; // $ES('.gk_ni_6_slide',wrap).each(function(el,i){ var newImg = new Element('img',{ "src" : el.innerHTML, "alt" : el.getProperty('title') }); imagesToLoad.push(newImg); el.innerHTML = ''; newImg.injectInside(el); }); // var timerrr = (function(){ var process = 0; imagesToLoad.each(function(el,i){ if(el.complete) process++; }); // if(process == imagesToLoad.length){ $clear(timerrr); loadedImages = process; (function(){new Fx.Opacity($E('.gk_ni_6_preloader', wrap)).start(1,0);}).delay(400); } }).periodical(200); } var timerrr2 = (function(){ if(loadedImages){ $clear(timerrr2); // ---------- var NI2 = new news_image_6(); // $ES(".gk_ni_6_tab",mainwrap).each(function(elx,index){ var hover = $E(".gk_ni_6_hover" , elx); var opacity_anim = new Fx.Opacity(hover, {duration: 250, wait: false}); // elx.addEvent("mouseenter",function(){ hover.setStyle("display", "block"); opacity_anim.start(1); }); // elx.addEvent("mouseleave",function(){ opacity_anim.start(0); (function(){hover.setStyle("display", "none");}).delay(250); }); // elx.addEvent("click", function(){ if(!$G["actual_anim_p"]){ $E(".gk_ni_6_tab_active",mainwrap).setProperty("class","gk_ni_6_tab"); elx.setProperty("class","gk_ni_6_tab_active"); } // NI2.image_anim(elID,mainwrap,wrap,slides,index,contents,$G,false); }); }); $E(".gk_ni_6_tab",mainwrap).setProperty("class","gk_ni_6_tab_active"); NI2.image_anim(elID,mainwrap,wrap,slides,0,contents,$G,($G["autoanim"]==1)); /** Slider implementation **/ if($E('.gk_ni_6_tabsbar_slider',mainwrap)){ var $offset = $E(".gk_ni_6_tab",mainwrap).getStyle("height").toInt() + $E(".gk_ni_6_tab",mainwrap).getStyle("margin-bottom").toInt(); var scrollArea = $E('.gk_ni_6_tabsbar_wrap', mainwrap); var scrollableArea = $E('.gk_ni_6_tabsbar', mainwrap); var scrollAreaH = scrollArea.getSize().size.y; var scrollableAreaH = scrollableArea.getSize().size.y; var scroller_up = new Fx.Scroll(scrollArea, {duration: 250, wait: true, transition: Fx.Transitions.Circ.easeIn, onComplete: function(){scrollValue -= $offset;}}); var scroller_down = new Fx.Scroll(scrollArea, {duration: 250, wait: true, transition: Fx.Transitions.Circ.easeIn, onComplete: function(){scrollValue += $offset;}}); // $E('.gk_ni_6_tabsbar_up', mainwrap).addEvent("click",function(){ if(scrollValue > 0) { scroller_up.scrollTo(0, scrollValue-$offset);} }); // $E('.gk_ni_6_tabsbar_down', mainwrap).addEvent("click",function(){ if((scrollValue < (scrollableAreaH-scrollAreaH))) { scroller_down.scrollTo(0, scrollValue+$offset); } }); } }}).periodical(250); }); }); // var news_image_6 = new Class({ // text_anim : function(wrap,contents,$G){ var txt = $E(".gk_ni_6_text",wrap); if(txt){ if($G["anim_type_t"] == 0){ new Fx.Opacity(txt,{duration: $G["anim_speed"]/2}).start(1,0); (function(){ new Fx.Opacity(txt,{duration: $G["anim_speed"]/2}).start(0,1);txt.innerHTML = contents[$G["actual_slide"]]; }).delay($G["anim_speed"]); } else txt.innerHTML = contents[$G["actual_slide"]]; } }, // image_anim : function(elID,mainwrap,wrap,slides,n,contents,$G,play){ var max = slides.length-1; var links = $ES('.gk_ni_6_news_link', mainwrap); var readon = $E('.gk_ni_6_readmore_button a', mainwrap); if(!$G["actual_anim_p"] && n != $G["actual_slide"]){ $G["actual_anim_p"] = true; if(readon) readon.setProperty("href", links[n].innerHTML); var actual_slide = $G["actual_slide"]; $G["actual_slide"] = n; slides[n].setStyle("z-index",max+1); if(actual_slide != -1) new Fx.Opacity(slides[actual_slide],{duration: $G["anim_speed"]}).start(1,0); new Fx.Opacity(slides[n],{duration: $G["anim_speed"]}).start(0,1); this.text_anim(wrap,contents,$G); switch($G["anim_type"]){ case 0: break; case 1: new Fx.Style(slides[n],'margin-top',{duration: $G["anim_speed"]}).start((-1)*slides[n].getSize().size.y,0);break; case 2: new Fx.Style(slides[n],'margin-left',{duration: $G["anim_speed"]}).start((-1)*slides[n].getSize().size.x,0);break; case 3: new Fx.Style(slides[n],'margin-top',{duration: $G["anim_speed"]}).start(slides[n].getSize().size.y,0);break; case 4: new Fx.Style(slides[n],'margin-left',{duration: $G["anim_speed"]}).start(slides[n].getSize().size.x,0);break; } if(play){ $E(".gk_ni_6_tab_active",mainwrap).setProperty("class","gk_ni_6_tab"); $ES(".gk_ni_6_tab",mainwrap)[n].setProperty("class","gk_ni_6_tab_active"); } (function(){slides[n].setStyle("z-index",n);}).delay($G["anim_speed"]); (function(){$G["actual_anim_p"] = false;}).delay($G["anim_speed"]); var $this = this; if(!play) this.image_pause($G); if((play || $G["autoanim"] == 1) && ($G["actual_anim"] == false)){ $G["actual_anim"] = (function(){ n = (n < max) ? n+1 : 0; $this.image_anim(elID,mainwrap,wrap,slides,n,contents,$G,true); }).periodical($G["anim_speed"] * 2 + $G["anim_interval"]); } } }, // image_pause : function($G) { $clear($G["actual_anim"]); $G["actual_anim"] = false; } }); if you take a look at this site here you can see that it no longer scrolls or even displays content, but here it does. I'll bet there's a quick fix here, but not sure what it is. Any ideas?
HI I want to write a search for my site .I make a new panel in the left of my menue and it has a text input and an image which when that user click on it javascript opens a new window which is a php page.The part I don't know how to do is when the user click on the image it should get the content of the text input and pass it to the url.For the hyperlink of the image I use "<a href="javascriptpen_window('includes/func/search.php?id=" But I don't know what should I write after that to get the content of the text input and put it in the next of the id. How can I do so? Thanks I am using a jQuery slider for a website but the W3C comes up with invalid because: document type does not allow element "div" here .before('<div id="buttons">') Code: <script type="text/javascript"> $(document).ready(function() { $('#slider') .before('<div id="buttons"></div>') .cycle({ fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc... pager: '#buttons' }); }); </script> Any help with this would be appreciated thanks. Its about this: http://www.wduffy.co.uk/blog/keep-el...omment-page-1/ Everywhere is used for a whole div on some side and when its on the top of the page. But what if its in the middle..? Look here - http://phpbb.bg/viewtopic.php?f=14&p=1013#p1013 Scroll down and then up.Anyway to fix this? i want to add a tooltip----click to copy to the Copy To Clipboard... box like this site(http://www.retailmenot.com). the yellow part with a Scissor. but when i used jquery to add it. it doesn't work. why? i test it on this site: Quote: http://bowser.effectgames.com/~jhuck...rd/test10.html Code: $(document).ready(function(){ $("#d_clip_container").hover( function () { $(this).append($('<span class="tip">click to copy</span>')); }, function () { $(this).find("span:last").remove(); }); }) i have added the jquery library. The reason of the tooltip can't work maybe the copied text is wrapped by the flash, but this site (retailmenot.com) can do. i don't know why? how to do it? thank you. Hello. I have a table with td elements containing numbers in one row and td elements containing textareas in the second row like this: http://motionsroom.com/example.html I want to find an easy way for the user to click, draw a rectangle around or whatever around any several numbers so that they they would be put in a single td element instead of two or three (so we would have: "49 and 12" as the new value) and then the textareas below would also merge. Ideally, I would like to have a rectangle like in RTS games but then I would settle on whatever is easy. Is there any way I could do that? Thanks! I am very new to javascript(and these forums) and I am teaching my self to use the canvas element. I am trying to draw an image to the canvas but nothing is appearing. And I am getting no error in the chrome console. Can anyone see why? Code: function RPGanimation(options) { this.initcanvas(options); this.initbackground(options); }; RPGanimation.prototype = { initbackground: function(options){ this.background = new Image(); this.background.src = options.backsource; this.background.onload = this.drawbackground(); }, initcanvas:function(options){ this.canvas = document.getElementById(options.canvasid); this.context = this.canvas.getContext('2d'); this.dimensions = {width:this.canvas.width,height:this.canvas.height}; }, drawbackground:function(){ //document.write('<IMG SRC="Chrysanthemum.jpg">'); this.context.drawImage(this.background,0,0,this.dimensions.width,this.dimensions.height); } }; I create the object in a webpage with the canvas element created just before that script tag... I am trying to make images change as the user selects the option from the dropdown menu , I have called alert("test1"); alert("test2"); to check if the functions are being called but only the first one happens, can you please tell me what's wrong with the script. Here is the script:
Code: var oImageChooser; addEvent( window, "load", initialize) function initialize() { alert("test1"); var oImageChooser = document.getElementById("imageChooser"); addEvent(oImageChooser, "change", loadCached); } var imageLibrary = new Array(); imageLibrary["image1"] = new Image(120,90); imageLibrary["image1"].src = "images/desk1.gif"; imageLibrary["image2"] = new Image(120,90); imageLibrary["image2"].src = "images/desk2.gif"; imageLibrary["image3"] = new Image(120,90); imageLibrary["image3"].src = "images/desk3.gif"; imageLibrary["image4"] = new Image(120,90); imageLibrary["image4"].src = "images/desk4.gif"; function loadCached() { alert("test2"); var imgChoice = oImageChooser.options[oImageChooser.selectedIndex].value; document.getElementById("thumbnail").src = imageLibrary[imgChoice].src; } here is the html Code: <html> <head><title>Image dropdown</title> <script type = "text/javascript" src = "experimento5.js"> </script> </head> <body onload = "initialize()"> <h1> Choose any image</h1> <img id = "thumbnail" src = "images/desk1.gif" > <form> <select id = "imageChooser"> <option value = "image1"> Bands</option> <option value = "image2"> Clips</option> <option value = "image3"> Lamp</option> <option value = "image4"> Erasers</option> </select> </form> </body> </html> I am new to javascript and would like to search for the element with id but the element id are changing if i use different navigation in that web page example: C21_W68_V69_notes_struct.text changes to C24_W78_V79_notes_struct.text or any other name next time hence i would like to search that element using a pattern like notes_struct.text as there exist only one element ending with this pattern. I am using old version IE and would like to use javascript only. Kindly help. Fairly new the javascript, as in only been tinkering around for about a day. So forgive me if this is a simple question. At the moment I have the following function for handling events such as onclick, mouseover, mouseout. Code: function switcher(action, img){ switch(action){ case "hover": //mouse is on image document.imgSeat.src = "images/hover.gif"; break; case "click": //mouse has clicked image document.imgSeat.src = "images/click.gif"; break; default: //mouse elsewhere document.imgSeat.src = "images/defaulter.gif"; break; } } And the html the function refers to Code: <body> <div id="imagesholder"> <a href="#nerf"><img border="0" id="seat0" src="images/available.gif"></a> </div> </body> What im trying to do change my function so that instead of it being hard coded for the id "imgSeat" i can use the id passed through the parameter "img" instead. However I seem to be banging my head against the wall. I've tried using the following Code: document.getElementById(img).src = "images/available.gif"; //no error, just does nothing //where img is "0" instead of "seat0" document.seat[img].src = "images/available.gif"; //error: document.seat is undefined Would be extremely greatful if someone should push me in the right direction or show me what im doing wrong. hello all, what i would like to implement is the following : http://mon.grnet.gr/network/maps/lite/?load&ip but, the problem is that, although the numerical data that show the traffic volume passing through a link are available to me, i do not have clue on how i can display them onto the map ... ? i would be thankful, if you could give me a piece of advice. I have a working script and I want to add a toogleGroup command (which I have) to the end of the working script so that I can toggle map markers with radio buttons. Probably a simple addition. WORKING CODE: Code: //<![CDATA[ var iconPink = new GIcon(); iconPink.image = 'http://www.golfinggreys.com/img/ggmap_icon_attraction.png'; iconPink.shadow = ''; iconPink.iconSize = new GSize(24, 31); iconPink.shadowSize = new GSize(0, 0); iconPink.iconAnchor = new GPoint(11, 30); iconPink.infoWindowAnchor = new GPoint(5, 1); var iconOrange = new GIcon(); iconOrange.image = 'http://www.golfinggreys.com/img/ggmap_icon_accomm.png'; iconOrange.shadow = ''; iconOrange.iconSize = new GSize(24, 31); iconOrange.shadowSize = new GSize(0, 0); iconOrange.iconAnchor = new GPoint(11, 30); iconOrange.infoWindowAnchor = new GPoint(5, 1); var iconPurple = new GIcon(); iconPurple.image = 'http://www.golfinggreys.com/img/ggmap_icon_dining.png'; iconPurple.shadow = ''; iconPurple.iconSize = new GSize(24, 31); iconPurple.shadowSize = new GSize(0, 0); iconPurple.iconAnchor = new GPoint(11, 30); iconPurple.infoWindowAnchor = new GPoint(5, 1); var iconGreen = new GIcon(); iconGreen.image = 'http://www.golfinggreys.com/img/ggmap_icon_golf.png'; iconGreen.shadow = ''; iconGreen.iconSize = new GSize(24, 31); iconGreen.shadowSize = new GSize(0, 0); iconGreen.iconAnchor = new GPoint(11, 30); iconGreen.infoWindowAnchor = new GPoint(5, 1); var iconRed = new GIcon(); iconRed.image = 'http://www.golfinggreys.com/img/ggmap_icon_golfr.png'; iconRed.shadow = ''; iconRed.iconSize = new GSize(24, 31); iconRed.shadowSize = new GSize(0, 0); iconRed.iconAnchor = new GPoint(11, 30); iconRed.infoWindowAnchor = new GPoint(5, 1); var iconGrey = new GIcon(); iconGrey.image = 'http://www.golfinggreys.com/img/ggmap_icon_services.png'; iconGrey.shadow = ''; iconGrey.iconSize = new GSize(24, 31); iconGrey.shadowSize = new GSize(0, 0); iconGrey.iconAnchor = new GPoint(11, 30); iconGrey.infoWindowAnchor = new GPoint(5, 1); var iconBlue = new GIcon(); iconBlue.image = 'http://www.golfinggreys.com/img/ggmap_icon_shopping.png'; iconBlue.shadow = ''; iconBlue.iconSize = new GSize(24, 31); iconBlue.shadowSize = new GSize(0, 0); iconBlue.iconAnchor = new GPoint(11, 30); iconBlue.infoWindowAnchor = new GPoint(5, 1); var customIcons = []; customIcons["attraction"] = iconPink; customIcons["accomm"] = iconOrange; customIcons["dining"] = iconPurple; customIcons["golf"] = iconGreen; customIcons["golfr"] = iconRed; customIcons["services"] = iconGrey; customIcons["shopping"] = iconBlue; var markerGroups = { "attraction": [], "accomm": [], "dining": [], "golf": [], "golfr": [], "services": [], "shopping": []}; function load() { if (GBrowserIsCompatible()) { var i = 0; // Create the map // Make sure this element has the same ID as your div map = new GMap2(document.getElementById("googlemap")); // Add controls for moving and zooming the map. Use GSmallMapControl for small maps map.addControl(new GSmallMapControl()); // Add controls for switching between regular and satellite views map.addControl(new GMapTypeControl()); // Set the starting position and zoom level when the map loads map.setCenter(new GLatLng(51.920556,-103.798828), 7); // Read the data from XML var request = GXmlHttp.create(); // Open the XML file request.open("GET", "east_central.xml", true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; // Obtain the array of markers and loop through it var markers = xmlDoc.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { // Obtain the attribues of each marker var lat = parseFloat(markers[i].getAttribute("lat")); var lng = parseFloat(markers[i].getAttribute("lng")); var point = new GLatLng(lat,lng); var name = markers[i].getAttribute("name"); var phone = markers[i].getAttribute("phone"); var address = markers[i].getAttribute("address"); var city = markers[i].getAttribute("city"); var state = markers[i].getAttribute("state"); var url = markers[i].getAttribute("url"); var type = markers[i].getAttribute("type"); var marker = createMarker(point,name,phone,address,city,state,url,type); map.addOverlay(marker); } } } request.send(null); // Function to create the marker and set up the event window function createMarker(point,name,phone,address,city,state,url,type) { var marker = new GMarker(point, customIcons[type]); markerGroups[type].push(marker); var markerhtml = ""; if (name != "") markerhtml += "<b>" + name + "</b><br>"; markerhtml += address + ", " + city + ", " + state + "<br>"; if (phone != "") markerhtml += "p:" + phone + "<br>"; if (url != "") markerhtml += "<a href=\"" + url + "\">COURSE DETAILS</a>"; // Add a click event to each marker which will open the HTML window GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(markerhtml); }); i++; return marker; } } // Javascript alert for older browsers where Google Maps isn't supported else { alert("Sorry, the Google Maps API is not compatible with this browser"); } } //]]> THE ADDITION Code: function toggleGroup(type) { for (var i = 0; i < markerGroups[type].length; i++) { var marker = markerGroups[type][i]; if (marker.isHidden()) { marker.show(); } else { marker.hide(); } Just need to properly add that to the end. I am okay at editing and adapting codes, but I don't know the sytax. Tried JSLINT but still confused. Probably quite simple. Thanks http://www.cricketcoachingclinics.com.au/ I am having a problem with site in IE7 this is identified as a problem?? Can someone at least rule out this js error? This is js generated when adding google maps Error Class is not defined <CODE>var GoogleMap=Class.create(Widget,{widgetIdentifier:"com-apple-iweb-widget-GoogleMap",initialize:function($super,instanceID,widgetPath,sharedPath,sitePath,preferences,runningI nApp) {if(instanceID){$super(instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp);}},mapReq uestTemplate:'center=#{center}&zoomLevel=#{zoomLevel}&showZoom=#{showZoom}&mapType=#{mapType}&locate dAddress=#{locatedAddress}&locatedAddressPoint=#{locatedAddressPoint}&showInfo=#{showInfo}&language= #{language}&showGoogleBar=#{showGoogleBar}',iframeTemplate:'<iframe id="#{instanceID}-iframe" name="#{instanceID}-iframe" src="#{mapURL}?#{mapRequest}" width="100%" height="100%" scrolling="no" marginheight="0" marginwidth="0" frameborder="0"></iframe>',mapURL:'http://www.me.com/st/1/sharedassets/maps/iweb2/',onload:function() {var mapRequestTemplate=new Template(this.mapRequestTemplate);var mapRequest=mapRequestTemplate.evaluate({center:this.escapedPreferenceForKey("center"),zoomLevel:this .escapedPreferenceForKey("zoomLevel"),showZoom:this.escapedPreferenceForKey("showZoom"),mapType:this .escapedPreferenceForKey("mapType"),locatedAddress:this.escapedPreferenceForKey("locatedAddress"),lo catedAddressPoint:this.escapedPreferenceForKey("locatedAddressPoint"),showInfo:this.escapedPreferenc eForKey("showInfo"),language:this.escapedPreferenceForKey("language"),showGoogleBar:this.escapedPref erenceForKey("showGoogleBar")});var iframeTemplate=new Template(this.iframeTemplate);var iframeText=iframeTemplate.evaluate({instanceID:this.instanceID,mapRequest:mapRequest,mapURL:this.map URL});this.div().innerHTML=iframeText;if(this.preferences&&this.preferences.postNotification) this.preferences.postNotification("BLWidgetIsSafeToDrawNotification",1);},escapedPreferenceForKey:fu nction(key) {var value=this.preferenceForKey(key);if(value!==undefined) value=encodeURIComponent(value);return value;}});</CODE> Hey all, I was wondering if someone would be able to help me with a problem I've been having. I'm attempting to find coordinates for several addresses at a time. I'm using a for-loop to loop through an array of addresses. I figured it would be best to have a separate function to evaluate the coordinate given an address, and just call it in every loop. Note that my code below is simplified (I removed the for loop because that's not where I'm having trouble). I know that the issue is probably because I'm trying to return a value from an anonymous function... I tried making the variable global, I tried having a return line from within the anonymous function, nothing has worked... any tips? Thanks -- Code follows Code: function initialize(){ var geocoder = new google.maps.Geocoder(); // creating a new geocode object var locCood = findcood('44106', geocoder); } function findcood(addr, geocoder) { var cood; if (geocoder) { geocoder.geocode({'address': addr}, function(results, status, cood){ if (status == google.maps.GeocoderStatus.OK) cood = results[0].geometry.location; else { cood = null; alert("Geocode was not successful for the following reason: " + status); } }); } else { alert("No Geocode"); cood = null; } alert(cood); return cood; } never mind
Im creating a portfolio site for myself that my have gotten a little too ambitious but I'd still like to make this work. My main site loads a video demo reel using the new <video> tag and to make it look cooler has an "ambilight" television effect around it. For usability and for users that find it annoying or distracting I want a toggle to turn the effect off. I have my checkbox created as well as all the effects working for it. Here is a piece of the main code as well as a link to the ambilight.js file Code: <label name="ambilightToggle"> <input type="checkbox" name="toggle"/> <div class="toggle-switch"> <div class="handle"></div> <div class="track"> <span>OFF</span><span>ON</span> </div> </div> </label> </div> </div> <div id="main" class="clearfix"> <div id="video-edge"> <img id="ribbon" width="112" height="112" alt="Demo Reel Ribbon" src="img/ribbon-demoreel.png"> <div id="video-wrap" class="video-js-box moo-css"> <video id="example" class="video-js" width="720" height="405" controls preload poster="posters/poster_demoreel2010.png"> <source src="video/demoreel2010.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' /> <source src="video/demereel2010.webm" type='video/webm; codecs="vp8, vorbis"' /> <source src="video/demoreel2010.ogv" type='video/ogg; codecs="theora, vorbis"' /> </video> </div> </div> <script type="text/javascript"> ambiLight.create(document.getElementById('example')) </script> Portfolio Page http://www.eschulist.com/test/js/ambilight.js I was able to make the ambilight effect go away using this, but it only works for a second as the video continues to play and the new lights are redrawn. Code: <script type="text/javascript"> $(document).ready(function(){ $(this).click(function(){ $('canvas.ambilight-left, canvas.ambilight-right').addClass('goAway'); }); }); </script> Any other ideas on what to do? If the click function works I should be able to have it check the checkboxes state and have it persist. Maybe? |