jQuery mobile Button controlgroup horizontal AND vertical - jquery-mobile

Is it possible to use the jQuery mobile controlgroups both horizontally AND vertically at the same time? I'd like to create button groups of e.g. 3x3 or 4x4 buttons without any space between them. Using three horizontal controlgroups with three buttons each leaves me with space between the "rows".
Thanks!

You can use a jQM grid and force 0 margins on the buttons. Then apply rounded corners just to the buttons at the corners of the grid:
<div class="ui-grid-b gridControlGroup" >
<div class="ui-block-a">1</div>
<div class="ui-block-b">2</div>
<div class="ui-block-c">3</div>
<div class="ui-block-a">1</div>
<div class="ui-block-b">2</div>
<div class="ui-block-c">3</div>
<div class="ui-block-a">1</div>
<div class="ui-block-b">2</div>
<div class="ui-block-c">3</div>
</div>
.gridControlGroup .ui-btn {
margin: 0 !important;
}
.gridControlGroup .ui-block-a:nth-child(1) .ui-btn {
border-top-left-radius: 5px;
}
.gridControlGroup .ui-block-c:nth-child(3) .ui-btn {
border-top-right-radius: 5px;
}
.gridControlGroup .ui-block-a:nth-last-child(3) .ui-btn {
border-bottom-left-radius: 5px;
}
.gridControlGroup .ui-block-c:nth-last-child(1) .ui-btn {
border-bottom-right-radius: 5px;
}
Here is a DEMO

Related

footer section getting bumped up into elements above it

I'm relatively new to web designing so hopefully what I'm writing here makes sense . . .
I have three sections on my page. A header, the middle section and the footer. Within the middle section there are three divs which include an image and text and each taking up 30% of the width of the entire middle section. When the page is decreased to smaller sizes, the footer bumps up onto this middle section. Of course, I'm wanting the footer section to remain at the bottom and be responsive.
At first I had these three divs floated left and I thought this may have something to do with the footer moving. But then I changed the divs to an inline-block.
I've also tried to clear: both. The footer keeps moving up when I scale down the page.
Hopefully, I'm making sense and someone can help. Thanks.
HTML:
<section class='mid-section'>
<div class='one-third'>
<a href='thai-tattoo.html'><img src='https://farm2.staticflickr.com/1528/26102511281_67fdc7c189_m.jpg' alt='Bangkok street'></a>
<h3>HEADLINE</h3>
<p>TEXT</p>
</div>
<div class='one-third'>
<a><img src='http://gratisography.com/pictures/264_1.jpg'><h3>HEADLINE</h3><p>TEXT</p>
</div>
<div class='one-third'>
<a><img src='http://gratisography.com/pictures/264_1.jpg'><h3>HEADLINE</h3><p>TEXT</p>
</div>
</section>
<div class='bottom-section'>
<div class='social-icons'>
<p > Follow us on the Web </p>
</div>
</div>
CSS:
.one-third {
width: 30%;
display: inline-block;
margin: 5% 0 0 2.5%; }
.one-third img {
width: 100%;
height: 300px; }
.one-third p {
margin: 0.5em; }
.tattoo-text {
width: 60%;
margin: 50px; }
.tattoo-h {
font-size: 25px; }
.tattoo-pic {
width: 60%;
float: right;
margin: 10px; }
.quaint-street-pic {
width: 60%;
float: left;
margin: 10px;
height: 300px; }
.social-icons {
float: right;
margin: 100px 100px 0 0; }

Bootstrap 100% Height

I am creating a widget page using asp.net 4.0 and bootstrap which is going to be accessed across a variety of different screens so I need to have the main content responsive to grow/shrink based on the size of the screen.
My current code is similar to this -
<div class="container-fluid">
<div class="row header">
HEADER ROW
</div><!--/.row-->
<div class="row">
MAIN CONTENT
</div
<footer>
FOOTER GOES HERE
</footer>
</div><!--/.container-fluid-->
So the header and the footer will be 100px or 10% each and I want the main content to expand the height in between the header and footer.
How can I do this without specifying a height in pixels?
Thanks
You can use flex box for this.
div.wrapper {
background:green;
display: flex;
flex-flow: column;
height: 100%;
}
.header {
border-bottom:1px solid black;
flex: 0 1 100px;
}
div.main {
flex: 1 1 auto;
}
footer {
border-top:1px solid black;
flex: 0 1 100px;
}
Example:
https://jsfiddle.net/tqaar3zr/2/

how will i get an image inside the sections using jquery mobile

here is my code http://jsfiddle.net/sanand29/5p8vgseh/2/ `
Page Header
</div>
<div class="ui-grid-a">
<div id="div1" class="ui-block-a">1st</div>
<div id="div2" class="ui-block-b">2nd</div>
<div id="div3" class="ui-block-a">3rd</div>
<div id="div4" class="ui-block-b">4th</div>
</div>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
.ui-grid-a div {
height: 150px;
}
#div1 {
background: #DDD;
background-image: url('xyz.png');
}
#div2 {
background: #AAA;
}
#div3 {
background: #777;
}
#div4 {
background: #444;
}
I am not getting the image inside the divided sections and even if i am getting image, its not responsive, please help
You need to add the following CSS to each of your div
background-size: 100% 100%;
background-repeat: no-repeat;
background-position: center center;

Making DIV in an IFRAME scrollable

Page A has an iframe (that loads Page B). That Page B has a div#OutputDiv. My goal is to make that div in that iframe scrollable.
SOLUTION (CREDIT TO STEVE!):
Include overflow: auto for that div. However you must specify height too. Simply give any fixed value. eg height: 0.
Use a javascript function to make the div's height always same as the window's, even after window resize. height is now not fixed.
Code:
#outputDiv {
font-size: 12px;
font-family: Arial;
margin-right: 1em;
overflow: auto;
overflow-x: hidden; (optional)
-webkit-overflow-scrolling: touch; (enable smooth scrolling on mobile)
height: 0; (omit-able)
}
$(window).resize(function(){
$("#outputDiv").css("height",0).css("height",$(this).height());
});
$(window).trigger("resize");
TL;DR Full story
Page A.html - has an iframe to load Page B. When on Page A, that div#OutputDiv in that iframe must be scrollable. Works fine on PC but not scrollable on iPad/Android. Page structure:
Page B.php - Left half div#OutputDiv, right half div#map-canvas containing Google Maps.
(Sidenote: I think the #map-canvas CSS is pretty unchangeable, for example changing something may cause the Maps to extend height beyond browser height, which is not what I want.)
Page A.html
<style type="text/css">
#title-banner {
position: fixed;
top: 0;
left: 0;
width: 100%;
}
#real-time-alert {
margin-top: 155px;
margin-left: 10px;
}
.tab-content {
border-left: 1px solid #ddd;
padding: 10px;
height: 100%;
}
#map {
height: 100%;
}
.nav-tabs {
margin-bottom: 0;
}
#panel {
position: fixed;
top: 120px;
right: 10px;
bottom: 10px;
left: 350px;
}
iframe {
width: 100%;
height: 100%;
}
</style>
<body>
<div id="title-banner" class="well"><h1>Real-time incident updates</h1></div>
<div id="real-time-alert">
DEMO:<br>
<a id="demolink" style="cursor: pointer; font-weight: bold;">22/11/2013, 0.32.18AM: 3.128268, 101.650656<br></a>
</div>
<div id="panel">
<ul class="nav nav-tabs" id="myTab">
<li class="active"><a data-toggle="tab" href="#map">Map</a></li>
<li><a data-toggle="tab" href="#message">Messages</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="map"><iframe seamless name="map-report"></iframe></div>
<div class="tab-pane" id="message"></div>
</div>
</div>
</body>
Page B.php
*for div#map-canvas, I had to do the code below, or else when I hover on the page, div#OutputDiv will disappear. This may be not important.
$("*").hover(function(){
$("#map-canvas").css("position","fixed"); });
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map-canvas {
height: 100%;
width: 50%;
}
#content-pane {
float:left;
width:48%;
padding-left: 2%;
}
#outputDiv {
font-size: 12px;
font-family: Arial;
margin-right: 1em;
}
</style>
<body>
<div id="content-pane">
<div class='well well-small' id="inputs" style="margin: 1em 1em 0 0">
<b>TESTING ONLY</b> <br>
<label for="originLat">Incident Site: </label><input type="text" id="originLat" style="width:6em;" />
<input type="text" id="originLng" style="width:6em;" />
<button type="button">Calculate distances</button>
</br>eg. 3.126547,101.657825
</div>
<div id="outputDiv"></div>
</div>
<div id="map-canvas" style="position: fixed; right: 1px;"></div>
</body>
I can't see any overflow controls specified in the CSS (apologies if I missed them).
Have you tried:
div#OutputDiv { overflow: auto; height: 200px; }
The height is just for testing purposes - but you could use Javascript to get the actual height and apply it using either raw javascript or jQuery.
A good example (including how to detect orientation changes if device goes portrait to landscape or similar) can be found on:
How do I get the new dimensions of an element *after* it resizes due to a screen orientation change?

jquerymobile: how to dispay both left, right icons for a button

How can I display both left, right data-icons for a button in jquerymobile.
Thanks in advance.
Thanks,
nehatha
In jQuerymobile documentation, you can fix icon position to one area. If you want to display both (left and right), customized CSS and JS are needed.
data-iconpos="left"
data-iconpos="right"
data-iconpos="top"
data-iconpos="bottom"
Try this in your header part:
<div data-role="header">
Home
<h1>Add Contacts</h1>
Search
</div>
Create a grid inside your button, then add an image in the left column then css style it to look the same
<a data-role="button" data-transition="slide" data-theme="b" href="#"
data-icon="arrow-r" data-iconpos="right">
<div class="ui-grid-b">
<div class="ui-block-a">
<img src="image.png" class="iconleft"/>
</div>
<div class="ui-block-b">
Button
</div>
<div class="ui-block-c">
</div>
</div>
</a>
CSS:
.iconleft {
position: absolute;
top: 50%;
margin-top: -9px;
left: -5px;
width: 18px;
height: 18px;
-moz-box-shadow: 0 1px 0 rgba(255,255,255,.4);
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,.4);
box-shadow: 0 1px 0 rgba(255,255,255,.4);
background-color: #666;
background-color: rgba(0,0,0,.4);
background-image: url(images/icons-18-white.png);
background-repeat: no-repeat;
-webkit-border-radius: 9px;
border-radius: 9px;
}
You can always do it the other way around, with the left being the dataicon and right being image but it doesn't really matter.
See my working example here or this fiddle

Resources