{"id":34617,"date":"2017-12-04T03:01:21","date_gmt":"2017-12-03T17:01:21","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=34617"},"modified":"2017-12-04T12:20:56","modified_gmt":"2017-12-04T02:20:56","slug":"bootstrap-jquery-plugin-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/bootstrap-jquery-plugin-primer-tutorial\/","title":{"rendered":"Bootstrap jQuery Plugin Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/dropcomparisonpunt.htm\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Bootstrap jQuery Plugin Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/\/HTMLCSS\/bootstrap.jpg\" title=\"Bootstrap jQuery Plugin Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Bootstrap jQuery Plugin Primer Tutorial<\/p><\/div>\n<p>If you&#8217;re one of those people who believe they live &#8220;around rocks&#8221; rather than &#8220;under a rock&#8221; it will not have passed your notice that (the CSS styling concept of) <a target=_blank title='Responsive Design Google search' href='https:\/\/www.google.com.au\/?client=firefox-b-ab#q=responsive+design&#038;gfe_rd=cr'>&#8220;responsive design&#8221;<\/a> (of webpages) and (the poor put upon) HTML <a target=_blank title='HTML table element information from W3schools' href='http:\/\/www.w3schools.com\/tags\/tag_table.asp'>&#8220;table&#8221;<\/a> element are not the happiest bedfellows.  In &#8220;responsive design&#8221; land, where &#8220;device width&#8221; is <a target=_blank title='Abstraction concept in OOP' href='https:\/\/stackify.com\/oops-concepts-in-java\/'>&#8220;abstracted&#8221;<\/a> away, you&#8217;d be using HTML <a target=_blank title='HTML div element information from W3schools' href='http:\/\/www.w3schools.com\/tags\/tag_div.asp'>&#8220;div&#8221;<\/a> elements instead.<\/p>\n<p>So, today, while it is fresh in our minds with yesterday&#8217;s <a title='CSS3 Flexbox Table Tutorial' href='#css3ftt'>CSS3 Flexbox Table Tutorial<\/a>, to have an &#8220;old paradigm&#8221; web application based on the HTML table element (and don&#8217;t think we are trying to &#8220;outlaw this&#8221; or anything &#8230; quite the reverse &#8230; as today we are encouraging a &#8220;conversion&#8221; feel) we want to introduce for the first time at this blog the great, the stupendous, <a target=_blank title='Bootstrap jQuery plugin' href='https:\/\/getbootstrap.com\/docs\/3.3\/javascript\/'>Bootstrap<\/a> <a target=_blank title='jQuery' href='https:\/\/jquery.com\/'>jQuery<\/a> <a target=_blank title='Plugin information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Plug-in_(computing)'>plugin<\/a>, as a tool (or &#8220;foot in the door&#8221;) into the &#8220;responsive design&#8221; world <font size=1> &#8230; see, we spared you the &#8220;woooooorrrrrrllllldddd&#8221;, that no doubt you regulars are so sick of??!!<\/font><\/p>\n<p>We have <a target=_blank title='Bootstrap jQuery plugin information from w3schools' href='https:\/\/www.w3schools.com\/bootstrap\/'>W3Schools<\/a> to thank for their tutorial leading us into directions to piece together our &#8220;Primer&#8221; tutorial today, which jumps a bit past a &#8220;Hello World&#8221; feel to it (and we may jump back to &#8220;Hello World&#8221; looks at a later date), onto a converting an HTML table based web application design, dynamically, into a &#8220;responsive design&#8221; via Bootstrap.  In broad brush terms what do we do to do that?<\/p>\n<ul>\n<li>we just add a button and some underlying Javascript to yesterday&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/dropcomparisonpunt.html----GETME\">dropcomparisonpunt.htm<\/a> code, respectively &#8230;<br \/>\n<code><br \/>\n&lt;input style='background-color:orange;padding: 5px 5px 5px 5px;' type='button' onclick='bootstrapme();' value='Bootstrap Look'&gt;&lt;\/input&gt;<br \/>\n<\/code><br \/>\n<code><br \/>\nfunction bootstrapme() {<br \/>\n  var subh=document.head.innerHTML.split('va' + 'r contis=');<br \/>\n  var contis=\"&lt;!doctype html&gt;&lt;html&gt;&lt;head&gt;&lt;meta charset='utf-8'&gt;&lt;meta name='viewport' content='width=device-width, initial-scale=1'&gt;&lt;link rel='stylesheet' href='https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/css\/bootstrap.min.css'&gt;&lt;script src='https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/3.2.1\/jquery.min.js'&gt;&lt;\/scr\" + \"ipt&gt;&lt;scr\" + \"ipt src='https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/js\/bootstrap.min.js'&gt;&lt;\/sc\" + \"ript&gt;\";<br \/>\n  contis += subh[0].replace(\/\\&lt;table\/g,\"&lt;div class=container\").replace(\/\\&lt;tr\/g,\"&lt;div class=row\").replace(\/\\&lt;td\/g,\"&lt;div class=col-sm-4\").replace(\/\\&lt;\\\/table\\&gt;\/g,\"&lt;\/div&gt;\").replace(\/\\&lt;\\\/tr\\&gt;\/g,\"\\&lt;\/div&gt;\").replace(\/\\&lt;\\\/td\\&gt;\/g,\"&lt;\/div&gt;\") + 'va' + 'r contis=' + subh[1]; \/\/ document.head.innerHTML;<br \/>\n  contis += \"&lt;\/head&gt;&lt;body&gt;&lt;div class='jumbotron text-center'&gt;\";<br \/>\n  contis += document.body.innerHTML.replace(\"['tr'\",\"['div'\").replace(\"&lt;table\",\"&lt;\/div&gt;&lt;table\").replace(\/\\&lt;table\/g,\"&lt;div class=container\").replace(\/\\&lt;tr\/g,\"&lt;div class=row\").replace(\/\\&lt;td\/g,\"&lt;div class=col-sm-4\").replace(\/\\&lt;\\\/table\\&gt;\/g,\"&lt;\/div&gt;\").replace(\/\\&lt;\\\/tr\\&gt;\/g,\"\\&lt;\/div&gt;\").replace(\/\\&lt;\\\/td\\&gt;\/g,\"&lt;\/div&gt;\");<br \/>\n  contis += \"&lt;\/body&gt;&lt;\/html&gt;\";<br \/>\n  var wo=window.open('','_blank','top=50,left=50,width=600,height=600');<br \/>\n  wo.document.write(contis);<br \/>\n}<br \/>\n<\/code>\n<\/li>\n<li> &#8230; and as you can surmise from that Javascript above we &#8230;\n<ol>\n<li>add up the top of document.head &#8230;<br \/>\n<code><br \/>\n  &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"&gt;<br \/>\n  &lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/css\/bootstrap.min.css\"&gt;<br \/>\n  &lt;script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/3.2.1\/jquery.min.js\"&gt;&lt;\/script&gt;<br \/>\n  &lt;script src=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;<br \/>\n<\/code>\n<\/li>\n<li>encase the (old) document.body &#8220;heading&#8221; parts to our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/dropcomparisonpunt.html----GETME\">changed code<\/a> into &#8230;<br \/>\n<code><br \/>\n&lt;div class='jumbotron text-center'&gt;<br \/>\n&lt;!-- Old heading bits (like <a target=_blank title='HTML h1 element information from W3schools' href='http:\/\/www.w3schools.com\/tags\/tag_h1.asp'>h1<\/a> element) go here --&gt;<br \/>\n&lt;\/div&gt;<br \/>\n<\/code>\n<\/li>\n<li>All document.body and old (ie. former) document.head mentions of &#8220;&lt;table&#8221; get mapped to &#8220;&lt;div class=container&#8221; (and &#8220;&lt;\/table&gt;&#8221; to &#8220;&lt;\/div&gt;&#8221;)<\/li>\n<li>All document.body and old (ie. former) document.head mentions of &#8220;&lt;tr&#8221; get mapped to &#8220;&lt;div class=row&#8221; (and &#8220;&lt;\/tr&gt;&#8221; to &#8220;&lt;\/div&gt;&#8221;)<\/li>\n<li>All document.body and old (ie. former) document.head mentions of &#8220;&lt;td&#8221; get mapped to &#8220;&lt;div class=col-sm-4&#8221; (and &#8220;&lt;\/td&gt;&#8221; to &#8220;&lt;\/div&gt;&#8221;)<\/li>\n<\/ol>\n<\/li>\n<li> &#8230; and present all this, dynamically, into a new popup window, via Javascript code &#8230;<br \/>\n<code><br \/>\n  var wo=window.open('','_blank','top=50,left=50,width=600,height=600');<br \/>\n  wo.document.write(contis);<br \/>\n<\/code>\n<\/li>\n<\/ul>\n<p> &#8230; for the user <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/dropcomparisonpunt.htm\" title=\"Click picture\">to try<\/a> (by click\/touch of (the newly introduced) &#8220;Bootstrap Look&#8221; button) themselves, or with around 200 guests &#8230; the wooooooorrrrrrlllllldddd&#8217;s your oyster!<\/p>\n<hr>\n<p id='css3ftt'>Previous relevant <a target=_blank title='CSS3 Flexbox Table Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/css3-flexbox-table-tutorial\/'>CSS3 Flexbox Table Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/dropcomparisonpunt.htm\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"CSS3 Flexbox Table Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/\/HTMLCSS\/flexmore.jpg\" title=\"CSS3 Flexbox Table Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">CSS3 Flexbox Table Tutorial<\/p><\/div>\n<p>If you were around for the recent <a title='CSS3 Flexbox Primer Tutorial' href='#css3fpt'>CSS3 Flexbox Primer Tutorial<\/a> and the concept of CSS3&#8217;s &#8230;<\/p>\n<p><code><br \/>\ndisplay: <a target=_blank title='CSS3 Flexbox information from w3schools' href='https:\/\/www.w3schools.com\/css\/css3_flexbox.asp'>flex<\/a>;<br \/>\nflex-direction: row; \/\/ default, or row-reverse or column or column-reverse<br \/>\n<\/code><\/p>\n<p> &#8230; and this was new to you regarding styling that can apply to a &#8220;parent&#8221; element of &#8220;children&#8221;, did you wonder as an almost immediate thought, as I had &#8230;<\/p>\n<blockquote><p>\nWhat happens with this CSS3 flexbox styling within an HTML table, specifically if you try it on a table&#8217;s <i>tr<\/i> (row) element?\n<\/p><\/blockquote>\n<p>Well, the answer is, you can &#8220;warp&#8221; a table, just for one or a few rows if you like, using this CSS3 flexbox styling.  We found out by incorporating dynamic CSS3 flexbox styling possibilities into a web application (about the trajectory of drop punt in Australian Rules football) of the past that had a set number of table rows (with ID defined) in HTML and CSS and Javascript code you could try yourself at this <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/dropcomparisonpunt.htm\" title=\"Click picture\">live run<\/a> link (with its underlying <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/dropcomparisonpunt.html---GETME\">dropcomparisonpunt.htm<\/a> changed in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/dropcomparisonpunt.html---GETME\">this way<\/a>).  We did this via an added HTML select &#8220;dropdown&#8221; element as per &#8230;<\/p>\n<p><code><br \/>\n&lt;select onchange=\" var trs, jtrs, itrs, its=['tr','h1'], wis=window.getComputedStyle(document.getElementsByTagName('table')[1], null).getPropertyValue('width'); if (wis.indexOf('px') == -1 || 1 == 1) { wis='100%'; } for (jtrs=0; jtrs&lt;its.length; jtrs++) {  trs=document.getElementsByTagName(its[jtrs]); for (itrs=0; itrs&lt;trs.length; itrs++) { trs[itrs].style.width=wis; trs[itrs].style.display='flex'; trs[itrs].style.flexDirection=this.value; } wis='100%'; document.getElementById('oflex' + jtrs).innerHTML=document.getElementById('oflex' + jtrs).innerHTML.replace('t view','t flex view'); }  \" id='sflex'&gt;&lt;option value='row' id='oflex0'&gt;Left to Right view&lt;\/option&gt;&lt;option value='row-reverse' id='oflex1'&gt;Right to Left flex view&lt;\/option&gt;&lt;\/select&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; which as you may have surmised applies, optionally, and in a user controlled way, CSS3 flexbox styling (only the row* options, though) to both &#8230;<\/p>\n<ol>\n<li><i>tr<\/i> table row elements &#8230; and &#8230;<\/li>\n<li><i>h1<\/i> header element<\/li>\n<\/ol>\n<p> &#8230; with interesting visual effects &#8230; we think?!  Perhaps &#8220;you think&#8221; too?!<\/p>\n<hr>\n<p id='css3fpt'>Previous relevant <a target=_blank title='CSS3 Flexbox Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/css3-flexbox-primer-tutorial\/'>CSS3 Flexbox Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/flextest.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"CSS3 Flexbox Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/\/HTMLCSS\/flextest.jpg\" title=\"CSS3 Flexbox Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">CSS3 Flexbox Primer Tutorial<\/p><\/div>\n<p>Responsive design is an important aspect to modern web design, because of the realities of the online world&#8217;s push to mobile devices, with their smaller device widths.  As the <a target=_blank title='CSS3 Flexbox information from w3schools' href='https:\/\/www.w3schools.com\/css\/css3_flexbox.asp'>W3Schools<\/a> website says &#8230;<\/p>\n<blockquote cite=''><p>\nThe Flexible Box Layout Module, makes it easier to design flexible responsive layout structure without having to use floats or positioning.\n<\/p><\/blockquote>\n<p> &#8230; and, yes, using the <i>display: flex<\/i> property is much more comprehensive a (CSS styling) concept than the <i>float<\/i> usage options web designers often relied on for this time of styling pre-CSS3.<\/p>\n<p>So, today, to try to show you a bit of how this new Flexbox Layout works, we write a proof of concept HTML and CSS and Javascript (source code file) you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/flextest.html_GETME\" title=\"flextest.html\">flextest.html<\/a> offering &#8230;<\/p>\n<ul>\n<li>all the four CSS <i>flex-direction<\/i> property variations (row, row-reverse, column, column-reverse) are offered for user-definement in an HTML select &#8220;dropdown&#8221; element &#8230; and &#8230;<\/li>\n<li>content of the &#8220;parent&#8221; HTML element that Flexbox Layout makes sense to apply to, are also offered for user-definement (with some generic lists, which always reminds me of the genius of Paul Kelly&#8217;s <a target=_blank title='Careless by Paul Kelly lyrics' href='https:\/\/genius.com\/Paul-kelly-careless-lyrics'>Careless<\/a> (whenever I think of lists))<\/li>\n<\/ul>\n<p>Why not try it out with a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/flextest.html\" title=\"Click picture\">live run<\/a> link yourself.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d34553' onclick='var dv=document.getElementById(\"d34553\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/css3\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d34553' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d34604' onclick='var dv=document.getElementById(\"d34604\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/table\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d34604' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d34617' onclick='var dv=document.getElementById(\"d34617\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/jquery\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d34617' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re one of those people who believe they live &#8220;around rocks&#8221; rather than &#8220;under a rock&#8221; it will not have passed your notice that (the CSS styling concept of) &#8220;responsive design&#8221; (of webpages) and (the poor put upon) HTML &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/bootstrap-jquery-plugin-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[2403,281,322,342,576,652,663,795,956,997,1991,1238,1319,2257],"class_list":["post-34617","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-bootstrap","tag-css","tag-device","tag-div","tag-html","tag-javascript","tag-jquery","tag-mobile","tag-plugin","tag-programming","tag-responsive-design","tag-table","tag-tutorial","tag-width"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/34617"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=34617"}],"version-history":[{"count":8,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/34617\/revisions"}],"predecessor-version":[{"id":34632,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/34617\/revisions\/34632"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=34617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=34617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=34617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}