start/play embedded (iframe) youtube-video on click of an image

The quick and dirty way is to simply swap out the iframe with one that has autoplay=1 set using jQuery. THE HTML Placeholder: <div id=”videoContainer”> <iframe width=”450″ height=”283″ src=”https://www.youtube.com/embed/VIDEO_ID_HERE?wmode=transparent” frameborder=”0″ allowfullscreen wmode=”Opaque”></iframe> </div> Autoplay link: <a class=”introVid” href=”#video”>Watch the video</a></p> THE JQUERY The onClick catcher that calls the function jQuery(‘a.introVid’).click(function(){ autoPlayVideo(‘VIDEO_ID_HERE’,’450′,’283′); }); The function /*——————————– … Read more

Click toggle with jQuery

This is easily done by flipping the current ‘checked’ state of the checkbox upon each click. Examples: $(“.offer”).on(“click”, function () { var $checkbox = $(this).find(‘:checkbox’); $checkbox.attr(‘checked’, !$checkbox.attr(‘checked’)); }); or: $(“.offer”).on(“click”, function () { var $checkbox = $(this).find(‘:checkbox’); $checkbox.attr(‘checked’, !$checkbox.is(‘:checked’)); }); or, by directly manipulating the DOM ‘checked’ property (i.e. not using attr() to fetch the … Read more

How to track a Google Adwords conversion onclick?

Don’t know if you’ve already found it… I mention it anyway for future surfers… I was looking for the same, and found this piece of code : <script type=”text/javascript”> function trackConv(google_conversion_id, google_conversion_label) { var image = new Image(1, 1); image.src = “//www.googleadservices.com/pagead/conversion/” + google_conversion_id + “/?label=” + google_conversion_label + “&script=0”; } </script> Then for links … Read more

chart.js – link to other page when click on specific section in chart

You can use getElementAtEvent() method to detect which section/slice of your pie chart was clicked on, and based on that open a link/page accordingly. Here is a quick example : var canvasP = document.getElementById(“pieChart”); var ctxP = canvasP.getContext(‘2d’); var myPieChart = new Chart(ctxP, { type: ‘pie’, data: { labels: [“Värde 1”, “Värde 2”, “Värde 3”, … Read more

how to intercept Button click inside UIWebview on IOS?

You can do the following: In your HTML <a class=”yourButton” href=”https://stackoverflow.com/questions/10992339/inapp://capture”>Button Text</a> In your UIWebViewDelegate – (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { if ([request.URL.scheme isEqualToString:@”inapp”]) { if ([request.URL.host isEqualToString:@”capture”]) { // do capture action } return NO; } return YES; } I added “capture” to your button’s URL so that you could distinguish between several … Read more