Fixed CSS element moves page down when input focused in iOS - javascript

I am having a little UI issue and cannot work it out.
On an iOS device, when I click in the input QTY value on the fixed buy element at bottom, it shifts the whole page to the bottom.
CSS:
.product-bottom-sticky {
position: fixed;
bottom: 0;
background: #000000;
width: 100%;
padding: 0 14px 2px 0;
color: #ffffff;
display: none;
z-index: 1;
ul {
margin: 0;
li a span {
display: block;
font-size: 0.4em;
text-align: center;
margin-top: -6px;
margin-bottom: 5px;
}
}
.zopim-call-chat {
float: left;
font-size: 2em;
color: #ffffff;
}
.sticky-add-to-cart {
float: right;
margin: 6px 0 0 0;
padding: 3px 22px 9px 22px;
text-decoration: none;
}
.sticky-add-to-cart i {
font-size: 1.4em;
top: 2px;
left: -3px;
}
}
.sticky-qty div.form-control {
margin-bottom: 0px;
margin-top: 6px;
}
#media #{$mobile-breakpoint} {
.product-bottom-sticky {
display: block;
}
.sticky-chat {
float: left;
border-right: 1px solid #333333;
padding-right: 15px;
padding-top: 7px;
padding-left: 14px;
background: #555555;
}
.sticky-qty {
float: right;
width: 31%;
padding-top: 7px;
}
.sticky-qty label {
float: left;
color: #ffffff;
margin-top: 10px;
display: none;
}
.sticky-qty .quantity-input {
width: 31%;
float: right;
padding-top: 7px;
}
.sticky-add .button-add-to-cart {
background: #f14fa1;
border-color: #f14fa1;
}
.sticky-add,
.sticky-out {
float: right;
width: 52%;
padding-top: 7px;
}
}
Update
I found a partial solution here:
https://www.igorkromin.net/index.php/2016/05/20/mobile-safari-scrolling-problem-with-an-input-field-inside-a-fixed-div/
CSS:
html,body{
-webkit-overflow-scrolling : touch !important;
overflow: auto !important;
height: 100% !important;
}
This fixed the issue but created another issue: when I click the tabs it scrolls to the top.
Update 2
This is my JS which seems to be conflicting - maybe as it's using body, html. Is there a way to sort it since the input fix I added? It just seems to jump to the top of the tab on changing the tabs.
JS:
function scrollToTab(x) {
$("html, body").animate({
scrollTop: $(x).offset().top - 10
}, scrollSpeed);
}

Related

What changes should I make in the code in order to bring the texts within the line in mobile?

I'm from a non-tech background. I want to edit the trending page of my website so that the title of the songs appear within the same line as they appear in desktop and tablet. What changes should I make in order to achieve it? If someone could help me out I'd be really grateful.
Mobile
Desktop
.home_trending {
background: #fff;
padding: 25px;
}
.inner_home_trending:nth-child(2n+1) {
clear: left;
}
.home_inner_details {
width: 70%;
display: inline-block;
vertical-align:middle;
padding-left: 15px;
}
.home_p p {
margin: 0px !important;
}
.home_p .module-head {
border-top: 6px solid #7464f2;
border-radius: 3px;
}
.img_back .header img,
.movie_fream img,
.main-post img{
background-image: url(https://themusicalsafari.com/wp-content/uploads/2020/07/border.jpeg);
background-size: cover;
padding: 25px 25px;
background-position: center;
background-repeat: no-repeat;
}
.textwidget .main-post img,
.music_img .main-post img {
padding:17px;
}
.home_inner_details h2 {
font-size: 18px;
padding-bottom: 5px;
}
.home_inner_details a {
color: #333;
font-weight: 600;
}
.inner_number {
width: 10%;
display: inline-block;
vertical-align:middle;
text-align: left;
font-size: 18px;
color: #ccc;
font-weight: 700;
}
.inner_img {
width: 18%;
display: inline-block;
vertical-align:middle;
}
.music_img .header {
padding: 15px;
}
.img_back .main-post h2.entry-title {
margin-right: 15px;
}
.img_back .main-post .entry-title,
.img_back .main-post .post-meta.vcard{
display:block;
vertical-align: middle;
}
.inner_home_trending {
width: 50%;
float: left;
padding: 15px;
border-bottom: 1px solid #ccc;
}
.main_meta_val p {
color: #666;
}
.main_meta_val span {
font-weight: 600;
}
.ly_text_center{
text-align:center;
margin-top: 20px !important;
}
.post_col_movies a.viewmore {
text-align: center;
width: 100%;
display: block;
color: #28aaab;
}
.movie_block .post-content span {
width: 100%;
text-align: center;
display: block;
}
As I've mentioned above, I've zero knowledge about coding, still, I tried to change certain values, and see what would happen, but I couldn't get the result I wanted.
try to use flex-wrap: nowrap; on the element that has the photo and the title, here it is better described https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap

adding multiple menu using slickNav

I'm trying to add 2 menu using slickNav. I've successfully created one but if I try to add another, I can't style it separately, I tried using prependTo, but when I stick it like #menu .slicknav_menu{} it just hide my nav.
Can't seem to find another solution to this. Please help me out.
here is my default code when I successfully created my nav:
.slicknav_menu{
display: none;
}
#media screen and (max-width: 992px){
header {
background-color: #fff;
}
#menu {
display: none;
}
.slicknav_menu {
display: inline-block;
position: absolute;
background: rgba(0,0,0,0);
z-index: 1000;
right: 0px;
font-weight: bold;
}
.slicknav_btn{
background-color: #c9251c;
margin: 35px 30px 0 0;
}
.slicknav_nav{
background: #c9251c;
width: 200px;
}
.slicknav_nav li {
margin: 0;
padding: 0;
height: 3em;
line-height: 3em;
width: 200px;
border-bottom: 1px solid #ba1e16;
border-top: 1px solid #d11e14;
text-align: center;
}
.slicknav_nav li a {
margin: 0;
padding: 0;
}
.slicknav_nav li a:hover {
color: #000;
background-color: rgba(0,0,0,0);
}
}

css center middle element in div for multiple screen sizes

<div class="add_nav_header">
<div class="centerButtons">
<a class="btnLogout smallBtn" data-role="button"></a>
<a class="btnSearch smallBtn" data-role="button"></a>
<a class="btnViewList smallBtn" data-role="button"></a>
</div>
</div>
.centerButtons {
width: 50%;
margin: 0 auto;
}
.add_nav_header {
display: inline-block;
width: 100%;
border-bottom: 1px solid #ccc;
padding-bottom: .5em;
}
.smallBtn {
float: right;
margin: .3em;
padding: .6em;
font-size: .9em;
}
.btnLogout {
float: right;
}
.btnViewList {
float: left;
}
.btnSearch {
left: -33%;
}
This is my html and css and I want to center the middle btnSearch button but I don't want to have to set the left percentage for every screen size with media queries.
jsfiddle example
You could use text-align: center to the container and remove float from div you want to be centered.
.centerButtons {
width: 50%;
margin: 0 auto;
text-align: center;
}
.add_nav_header {
display: inline-block;
width: 100%;
border-bottom: 1px solid #ccc;
padding-bottom: .5em;
}
.smallBtn {
/* float: right; */
margin: .3em;
padding: .6em;
font-size: .9em;
display: inline-block;
}
.btnLogout {
float: left;
}
.btnViewList {
float: right;
}
/* .btnSearch {
left: -33%;
} */
Fiddle: http://jsfiddle.net/zfh1ono0/
I'm not sure if I fully understand your question, but this link might help you: CSS centering. The key is this line:
transform: translate(-50%, -50%);

How do dynamically resize a image - CSS / HTML

I'm trying to dynamically resize a .png image to whatever text is put on the box. As you can see from the printscreen it doesn't resize dynamically to fit the text in the box. I have no idea how to make it work ... the link to that page is here. I've tried formatting the padding, margins and adding classes and divs to that, but it didn't work. A link to the website can be found here.
So the problem in the
<div id='page' class='container'>:
<div id="page-bg1">
<div id="page-bg2">
<div id="page-bg3">
<div id="page" class="container">
<div class="box-style2" id="content">
<h2 class="title">Services</h2>
<p>Our experience and business ethics have evolved over several decades of working in the cleaning industry. We understand the importance of supervision, training, communication, and customer satisfaction. The facility types we serve include commercial, healthcare, corporate, education, industrial, manufacturing, and auto dealerships
</p>
<h2>Building Maintenance Services:</h2>
<ul>
<li><b>Contract Custodial Cleaning:</b> Outsourcing of custodial cleaning is a way for corporate clients to reduce their direct costs while ensuring that quality control standards are met. We can work within your existing cleaning specifications or custom design a complete program for your nightly cleaning requirements, including all labor, cleaning equipment and complete supervision. Additional value-add features include consumable product inventory control, periodic project cleaning, and quality control site audits.
</li>
<li><b>Certified Cleanroom Attendant Services: </b>
Cleanroom cleaning is a highly-specialized function and critical part of our clients’ quality control standards. We can develop and implement a program that will conform to your protocols. Our Attendants are trained and certified in all areas of contamination control including waste removal, gowning procedures, cleaning techniques and equipment handling.
</li>
</ul>
</div>
<div id="sidebar">
<div id="box2" class="box-style2">
<h2 class="title">Specialized Cleaning Services</h2>
<ul class="style3">
<li>ESD and composition tile floor refinishing and maintenance</li>
<li>Carpet and area rug cleaning</li>
<li>Cubicle fabrics partition and upholstery cleaning</li>
<li>Kitchen and cafeteria cleaning</li>
<li>Window and glass cleaning</li>
<li>Wall and ceiling cleaning</li>
</ul>
</div>
<div id="box3" class="box-style2">
<h2 class="title">Additional Services</h2>
<ul>
<li>Post-construction cleanup</li>
<li>Temporary hourly-rate personnel</li>
<li>Matron/day porters</li>
<li>Pressure washing</li>
<li>Painting</li>
<li>Relamping</li>
<li>Mold and mildew treatments</li>
<li>Fabric and carpet soil protection</li>
<li>Carpet deodorizing</li>
<li>Floor mat purchase and rental programs</li>
<li>Flame retardant applications</li>
<li>Static control applications</li>
<li>Seasonal school dormitory cleaning</li>
</ul>
</div>
</div>
</div>
</div>
</div>
The CSS is here:
html, body {
height: 100%;
}
body {
margin: 0px;
padding: 0px;
background: url(palette/png/Background/bg.png) repeat left top;
font: 14px/26px "Arvo", Georgia, "Times New Roman", Times, serif;
//color: #94856A;
color: #0020C2;
}
a
h1, h2, h3 {
margin: 0px;
padding: 0px;
font-family: 'Arvo', serif;
}
p, ol, ul {
margin-top: 0px;
}
strong {
}
a {
color: #789329;
}
a:hover {
text-decoration: none;
}
a img {
border: none;
}
img.border {
}
img.alignleft {
float: left;
}
img.alignright {
float: right;
}
img.aligncenter {
margin: 0px auto;
}
hr {
display: none;
}
.image-wrapper {
position : relative;
}
.scale-image {
display : block;
width : auto;
max-width : 75% ;
}
/** WRAPPER */
#wrapper {
background: url(palette/png/Background/bg.png) repeat left top;
}
#main-bg {
background: url(palette/png/Background/bg_combined.png) repeat center top;
}
.container {
width: 1000px;
margin: 0px auto;
}
.clearfix {
clear: both;
}
/** HEADER */
#header {
}
/** LOGO */
#logo {
height: 183px;
background: url(images/fmn_200.jpg) no-repeat center top;
text-align: center;
text-transform: uppercase;
}
#logo h1, #logo p {
margin: 0px;
}
#logo h1 {
padding-top: 107px;
letter-spacing: 2px;
line-height: 25px;
font-size: 25px;
color: #FFFFFF;
}
#logo h1 a {
text-decoration: none;
color: #FFFFFF;
}
#logo p {
padding-top: 15px;
letter-spacing: 1px;
line-height: 14px;
font-size: 14px;
color: #776D5C;
background: url(image/fmn_200.jpg);
}
/** MENU */
#menu {
height: 100px;
background: url(images/crop.png) repeat center top;
}
#menu ul {
height: 69px;
margin: 0px;
padding: 31px 0px 0px 0px;
list-style: none;
line-height: normal;
text-align: center;
}
#menu li {
display: inline;
}
#menu a {
display: inline-block;
margin: 0 30px;
text-decoration: none;
font-weight: bold;
text-transform: uppercase;
text-decoration: none;
line-height: 68px;
font-size: 14px;
color: #FFFFFF;
}
#menu a:hover {
text-decoration: underline;
}
/** PAGE */
#page-bg1 {
overflow: hidden;
background: url(palette/png/CBG/cbg_shadow.png) repeat-x left bottom;
}
#page-bg2 {
background: url(palette/png/CBG/cbg_shadow.png) repeat-y center top;
}
#page-bg3 {
background: url(palette/png/CBG/cbg_combined.png) repeat center bottom;
}
#page {
overflow: hidden;
padding: 50px 0px 50px 0px;
}
.homepage #page {
height: auto !important;
height: 380px;
min-height: 380px;
}
/** SLIDERTRON */
#slidertron {
position: relative;
width: 900px;
height: 300px;
margin: 0px auto;
}
#slidertron .viewer {
width: 900px;
height: 290px;
overflow: hidden;
}
#slidertron .reel {
}
#slidertron .slide {
float: left;
width: 640px;
height: 260px;
background: #FFFFFF;
}
#slidertron .slide img {
padding: 9px;
border: 1px solid #E4E2DE;
}
#slidertron .indicator {
position: absolute;
bottom: 0px;
width: 100%;
height: 16px;
cursor: default;
user-select: none !important;
-khtml-user-select: none !important;
-moz-user-select: none !important;
-o-user-select: none !important;
-webkit-user-select: none !important;
}
#slidertron .indicator ul {
margin: 0px;
padding: 0px;
list-style: none;
text-align: center;
}
#slidertron .indicator li {
display: inline;
}
#slidertron .indicator li.active {
}
#slidertron .indicator a {
display: inline-block;
width: 16px;
height: 16px;
margin: 0px 3px;
background: url(images/slidertron_01.png) no-repeat -16px -258px;
text-indent: -9999em;
}
#slidertron .indicator li.active a {
background-position: 0px -258px;
}
#slidertron .navigation a {
position: absolute;
top: 1px;
display: block;
width: 125px;
height: 258px;
background: url(images/slidertron_01.png) no-repeat;
text-indent: -9999em;
}
#slidertron .navigation a.previous {
left: -1px;
background-position: 0px 0px;
}
#slidertron .navigation a.next {
background-position: 100% 0px;
right: -1px;
}
/** CONTENT */
#content {
float: left;
width: 600px;
padding-left: 50px;
}
.two-column2 #content {
float: right;
padding-right: 50px;
padding-left: 0px;
}
#wide-content {
overflow: hidden;
padding: 0px 50px;
}
/** SIDEBAR */
#sidebar {
float: right;
width: 260px;
padding-right: 50px;
}
.two-column2 #sidebar {
float: left;
padding-left: 50px;
padding-right: 0px;
}
#sidebar .title {
font-size: 18px;
}
/** FOOTER BLOCK */
#footer-block-wrapper {
overflow: hidden;
padding-bottom: 40px;
}
#footer-block-bg {
overflow: hidden;
padding-bottom: 30px;
background: url(palette/png/Background/bg_bar.png) repeat-y center top;
}
#footer-block-bgtop {
background: url(palette/png/Background/bg_bar.png) no-repeat center top;
}
#footer-block {
overflow: hidden;
width: 860px;
height: auto !important;
padding: 70px 70px 0px 70px;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #6C5F48;
}
#footer-block h2 {
margin: 0px;
padding: 0px 0px 20px 0px;
text-transform: uppercase;
font-size: 16px;
font-weight: bold;
color: #FFFFFF;
}
#footer-block #column1 {
float: left;
width: 240px;
margin-right: 70px;
}
#footer-block #column2 {
float: left;
width: 240px;
}
#footer-block #column3 {
float: right;
width: 240px;
}
/** FOOTER */
#footer {
padding: 50px 0px 70px 0px;
}
#footer p {
margin: 0px;
padding: 0px 0px 0px 0px;
text-align: center;
font-family: Arial, Helvetica, sans-serif;
color: #2F2518;
}
/** BOX 1 */
#box1 .title1, #box1 .title2 {
text-align: center;
}
/** BOX 2 */
#box2 {
margin-bottom: 30px;
}
/** BOX STYLE 1 */
.box-style1 {
}
.box-style1 .title1 {
padding: 0px 0px 5px 0px;
text-shadow: 1px 1px 1px #FFFFFF;
text-transform: uppercase;
font-weight: bold;
font-size: 26px;
color: #3C3223;
}
.box-style1 .title2 {
padding: 0px 0px 15px 0px;
text-shadow: 1px 1px 1px #FFFFFF;
text-transform: uppercase;
font-weight: normal;
font-size: 15px;
color: #8A7C60;
}
/** BOX STYLE 2 */
.box-style2 {
}
.box-style2 .title {
padding: 0px 0px 5px 0px;
letter-spacing: 1px;
text-transform: uppercase;
font-size: 26px;
font-weight: bold;
color: #3C3223;
}
.box-style2 .byline {
letter-spacing: 1px;
text-transform: uppercase;
font-size: 15px;
font-weight: normal;
color: #8B806F;
}
/** LINK STYLE 1 */
.link-style1 {
display: inline-block;
height: 48px;
margin: 9px 0px 0px 0px;
background: url(images/bio_2.png) repeat-x left top;
}
.link-style1 a {
display: inline-block;
height: 48px;
background: url(images/bio_1.png) no-repeat left top;
line-height: 48px;
text-decoration: none;
text-transform: uppercase;
font-family: 'Arvo', serif;
font-size: 14px;
font-weight: bold;
color: #FFFFFF;
}
.link-style1 span {
display: inline-block;
padding: 0px 30px 0px 30px;
background: url(images/bio_3.png) no-repeat right top;
color: #FFFFF;
}
/** LINK STYLE 2 */
.link-style2 {
display: inline-block;
background: url(images/homepage09.gif) no-repeat left 3px;
margin-top: 20px;
padding-left: 30px;
text-decoration: none;
color: #9F9788;
}
/** LINK STYLE 3 */
.link-style3 {
background: url(images/homepage10.gif) no-repeat left 2px;
padding-left: 30px;
text-decoration: none;
color: #9F9788;
}
/** LIST STYLE 1 */
ul.style1 {
margin: 0px;
padding: 0px;
list-style: none;
}
ul.style1 li {
}
ul.style1 a {
color: #6C5F48;
}
/** LIST STYLE 2 */
ul.style2 {
margin: 0px 0px 10px 0px;
padding: 10px 0px;
list-style: none;
}
ul.style2 li {
float: left;
margin-right: 9px;
}
/** LIST STYLE 3 */
ul.style3 {
margin: 0px 0px 0px 0px;
padding: 0px 0px;
list-style: none;
}
The images which needs to be resized are palette/png/CBG/cbg_combined.png and palette/png/CBG/cbg_shadow.png, presented in the divs #page-bg3, #page-bg2 and #page-bg1. That's the image that I wanted to resize according to the div text presented in that box.. I'm also adding a screenshot so you guys can have an idea of the problem.
What can I do to make it work? I only need this central banner to be able to dynamically resize.
I'm also adding a screenshot of how I wanted the page to look like:
Basically, I have cropped your background and used it in a differnt way. You can get the images from the following link:
#page-bg1
#page-bg2
#page-bg-3
And here's my code:
#page-bg1 {
overflow: hidden;
background: url(https://dl.dropboxusercontent.com/u/23887590/cbg_combined2.png) center;
}
#page-bg2 {
background: url(https://dl.dropboxusercontent.com/u/23887590/cbg_combined.png) repeat-y center top;
}
#page-bg3 {
background: url(https://dl.dropboxusercontent.com/u/23887590/cbg_combined1.png) no-repeat center bottom;
}
Little Explanation:
#page-bg1 is the background behind and outside the box.
#page-bg-2 is a vertically repeating background inside the box where you put your content.
#page-bg-3 is a backgroud with dashed border at the bottom of your content box which doesn't repeat but is always fixed at the bottom.

Elements Not Sliding Back Upon Window Change

I'm using an HTML/CSS template to create a web app. For some reason the elements are not sliding back on the template when I resize the window which I need them to do. For example, if I float a button on the right it would position itself to the leftmost portion of the full screen. If I then contract the window horizontally the button does not move back but is simply 'hidden by the window'. I've been looking at the template CSS code for days now and googling everywhere but I still don't know what's causing this.
Here is the CSS code for the template:
body, html {
padding:0;
margin:0;
font-family: BBAlpha Sans;
font-size: 15pt;
overflow:visible;
}
body {
background-image: url('../images/stripes.png');
overflow:hidden;
}
.listSeparator
{
border-bottom: solid 1px Silver;
}
.label
{
display:inline;
float:left;
line-height:40px;
margin-left: 5px;
}
.row
{
height: 40px;
width:100%;
vertical-align: middle;
}
.tab
{
position:absolute;
top:70px;
padding: 10px;
}
.main-panel
{
position:relative;
}
.panel-top-left {
margin-right: 4px;
height: 4px;
background-image: url('../images/panel.png');
}
.panel-top-right {
margin-top: -4px;
margin-left: 4px;
background-position: 100% 0;
height: 4px;
font-size: 2px;
background-image: url('../images/panel.png');
}
.panel-bottom-left {
margin-right: 9px;
background-position: 0 -7px;
height: 9px;
font-size: 2px;
background-image: url('../images/panel.png');
}
.panel-bottom-right {
margin-top: -9px;
margin-left: 9px;
background-position: 100% -7px;
height: 9px;
font-size: 2px;
background-image: url('../images/panel.png');
}
.panel-inside {
border-left: 2px solid #D6D3D6;
border-right: 2px solid #D6D3D6;
background: White;
padding-left: 0px;
padding-right: 0px;
overflow:auto;
}
.panel-nogap {
margin-top: -3;
margin-bottom: -3;
}
.panel-nogap input
{
display:inline;
float:left;
font-family: BBAlpha Sans;
font-size: 16pt;
border: none;
padding-top: 0px;
width: 10px;
margin-top: 7px;
}
.buttonPanel
{
margin-top: 5px;
margin-left: 8px;
margin-bottom: 0px;
text-align:center;
position:relative;
}
a.tabButton {
background: transparent url('../images/tabs/tabRight.png') no-repeat scroll top right;
color: White;
display: block;
float: left;
height: 64px;
margin-right: 5px;
padding-right: 10px;
text-decoration: none;
width: 28%;
}
a.tabButton div {
background: url('../images/tabs/tab.png') no-repeat top left;
display: block;
height: 64px;
padding: 0px 0px 0px 10px;
line-height: 0px;
}
a.tabButton p
{
font-size: 10pt;
margin-top: 0px;
padding: 0px;
}
a.tabButton img
{
position:relative;
height:35px;
width:35px;
margin-top: 5px;
margin-bottom: 0px;
padding: 0px;
}
.tabSeparator
{
position: absolute;
top:69px;
background-color:#014EBE;
height:5px;
width: 100%;
z-index: -1;
}
and what the template looks like:
If anyone knows what is causing this or at least what I should look for, any help at all would be appreciated. Thanks in advance!
How about changing the position properties... fixed would be your best bet: positioning it fixed # 5em from the browser sides or something:
http://www.w3schools.com/cssref/pr_class_position.asp
play around on w3schools, it's a great site :)

Categories