Introducing new responsive classes

This commit is contained in:
2017-09-26 13:01:10 +08:00
parent 6945834de5
commit 6c72ee9def
6 changed files with 23 additions and 95 deletions
@@ -34,26 +34,6 @@
}
content_wrapper.appendChild( padder );
IDOMObject( window ).addEventListener( "Resize", responsify );
responsify( null, true );
};
var rspd_ratio = 0;
var responsify = function( e, override )
{
// Ratio changes would trigger content
var ratio = wsupp.clientWidth / wsupp.clientHeight;
// Swap only on ration changes from 1 < x OR x < 1
if( ( ratio < 1.2 && 1.2 < rspd_ratio ) || ( 1.2 < ratio && rspd_ratio < 1.2 ) || override )
{
rspd_ratio = ratio;
debug.Info( "Responsive Event: R = " + ratio );
BotanJS.dispatchEvent( new BotanEvent( "Responsive", { "ratio": ratio } ) );
}
};
Bootstrap.regInit( init );
+15 -13
View File
@@ -1,19 +1,22 @@
.contentWrap {
position: relative;
width: 100%;
}
#dockleft {
position: absolute;
z-index: 0;
/* Responsive class: if smaller than N em */
@media print, screen and (max-width: 79em) {
.rs .rs-w100 { width: 100%; }
.rs .rs-child-w100 > div { width: 100%; }
.rs .rs-auto-margin { margin: 0 auto; }
.rs .rs-auto-width { width: auto; }
.rs .rs-text-center { text-align: center; }
.rs .rs-rel-on { position: relative; }
.rs .rs-inline-on { display: inline; }
}
.main {
/* background-color: #FAFAFA; */
vertical-align: top;
min-width: 70%;
position: relative;
/*background-color: #FAFAFA;*/
/*border-right: #76400C solid 0.2em;*/
}
/**
@@ -32,12 +35,11 @@ ul.breadcrumb > li.sep:after { content: "\2022"; }
min-width: 30%;
}
#dockright {
.dockright {
position: relative;
/*border-right: #76400C solid 0.2em;*/
}
#dockright > div {
.dockright > div {
float: right;
margin: 0 -.3em;
@@ -50,7 +52,7 @@ ul.breadcrumb > li.sep:after { content: "\2022"; }
min-height: 7px;
}
#extend_sec, #dockright {
#extend_sec, .dockright {
/* Same as dockright */
width: 100%;
}
+1 -32
View File
@@ -1,32 +1 @@
(function(){
var ns = __namespace( "Astro.Starfall.Layout.TwoColumn" );
/** @type {Dandelion} */
var Dand = __import( "Dandelion" );
/** @type {Astro.Bootstrap} */
var Bootstrap = __import( "Astro.Bootstrap" );
var init = function ()
{
var rspd = Dand.id( "dockright", true );
if( rspd )
{
BotanJS.addEventListener( "Responsive"
/** e @type {Astro.Starfall.Events.Responsive} */
, function( e ) {
if( e.data.ratio < 1.2 )
{
document.body.setAttribute( "data-narrow", 1 );
rspd.foreach( document.ELEMENT_NODE, function( elem ) { elem.style.width = "100%"; } );
}
else
{
document.body.removeAttribute( "data-narrow" );
rspd.foreach( document.ELEMENT_NODE, function( elem ) { elem.style.width = ""; } );
}
});
}
};
Bootstrap.regInit( init );
})();
// __namespace( "Astro.Starfall.Layout.TwoColumn" );