Showing posts with label JS. Show all posts
Showing posts with label JS. Show all posts

Wednesday, September 5, 2012

Toggle div using ruby on rails

Hello Guys,
        Toggle is the function of prototype.js. We just have to use it to perform toggling.

eg.

html = "Toggle me <span id='collapse'>"
html << link_to_function(image_tag("arrow_normal.png", :style => 'border:none;'), "$('collapse').toggle();$('expand').toggle(); new Effect.Highlight('DIVID',{endcolor:'#ffffff', startcolor:'#ffffc8', duration:2.0}); return false;")
html << "</span>"    
html << "<span id='expand' style='display:none'>"
html << link_to_function(image_tag("arrow-down.png", :style => 'border:none;'), "$('collapse').toggle();$('expand').toggle();return false;")
html << "<div id='DIVID'> HELLO </div> </span>"

Initially it show the text as Toggle me with right arrow. but when you click on that i replace the right arrow to down arrow. And display the container area with text HELLO as per above eg.

Wednesday, April 25, 2012

Dygraph fails on IE 8

Hello Guys,
      Just discover the problem while loading dygraph on IE 8. There are possible scenarios for dygraph failure.

case 1. instanceof is not support
           replace instanceof with Object.prototype.toString.call()
           Line 500 of dygraph-utils.js replace
              typeof Node === "object" ? o instanceof Node :
           with
              typeof Node === "object" ? Object.prototype.toString.call(o) === Node :

case 2. canvas can't load

<!DOCTYPE html>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9">
<!--[if IE]><script src="excanvas.js"></script><![endif]-->
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="http://mycheckpoint.googlecode.com/svn-history/r95/trunk/dygraphs/excanvas.min.js"></script><![endif]-->


Hope above article will help you.

Monday, December 26, 2011

Convert HTML to HAML and Javascript to Coffee script

Hello Guys,
        If you are using Rails 3 than as per it's standard format we have to use Haml and Coffee script instead of normal html and javascript.

There are some online tool available for conversation from one format to other.

HAML to HTML

HTML to HAML
http://html2haml.heroku.com/

JS to Coffee Script or visa versa
http://js2coffee.org/