Cannot scroll to absolute bottom of the page in mobile - javascript

Im trying to figure out whats going on in my website that in mobile devices im not able to scroll till the end where the arrow up is.
I need you to help me. Thanks
My website is www.agustinmoles.byethost32.com
EDIT: I have found that the error is in some part of this code, but I don't think its bad... hmmmm
function deSeccion1A2() {
deSeccionXaSeccionY('#section1 #portfolio i','#section2');
}
function deSeccion2A3() {
deSeccionXaSeccionY('#section2 .bottom-arrow','#section3');
}
function deSeccion3AContact() {
deSeccionXaSeccionY('#section3 .bottom-arrow','#contact-section');
}
function deContactATop() {
deSeccionXaSeccionY('#contact-section .bottom-arrow','#section1');
}
function deSeccionXaSeccionY (nombreElemento, nombreDivAMoverse) {
$(nombreElemento).click(function() {
var altoSection = $(nombreDivAMoverse).offset().top;
$('html, body').animate({scrollTop: altoSection},700);
});
}

The javascript on your page scrolls to each section so it fills the screen. On mobile the screen is not tall enough, so it can't fit the whole section, and because there is no next section it stops the scrolling. A lazy fix would be to disable that functionality on mobile or to adjust the bottom position of .adios and bottom-arrow.
If you can reproduce the issue on here using a code snippet, you might get some better solutions.
EDIT:
Try changing the font size of the below selector to font-size:2.8em. The title seems to be breaking out of the DIV which seems to be causing the issue. I am not 100% sure but this could be causing the vh units calculation to be off slightly.
#media screen and (max-width: 768px)
#contact-info h1 {
margin: 0 auto;
padding-top: 100px;
width: 97%;
line-height: 70px;
font-size: 3.8em;
}
}

Related

IOS scrolling issues (elastic scroll and bounce)

I have developed a site that has a fixed footer and header.
The content is also fixed (but that is only because the footer and header can be hidden, but I won't be showing that in my example).
The issue I have is with iPhones and iPads. They are two issues I have had.
Once is it allowing me to drag the header and footer past the confines of the body/html showing whitespace (no idea why they do this) and the other issue is it stopping scrolling as soon as I let go with my finger.
The latter seems to be solvable by doing this:
overflow-x: hidden;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
Although I have read that this is not a supported CSS attribute, it does seem to do the trick.
The second issue I have tried to solve with JavaScript by making the header and footer non-scrollable, but it doesn't seem to work properly.
The JavaScript is simple enough:
function disableElasticScroll(e) {
e.preventDefault();
};
which I can put on an element like this:
ontouchmove="disableElasticScroll(event)"
This does not have the desired effect.
I have set up a codepen to highlight the issue. If you have an ipad, have a look. First drag the content inside the .content area. That works nicely (thanks the the -webkit solution). If you then try and drag the .header or .footer you will notice that you can't drag it and no scrolling is happening (again this is good and is due to the JavaScript), but if you try to then scroll the .content again, you will notice that it drags the entire page and does the elastic scroll rubbish.
https://codepen.io/r3plica/pen/LzRQaZ
There is a way to do this so that you don't have to fix the scrolling container. Try positioning your header and footer with a fixed position then padding the body of your page by the height of those elements. This way your page will scroll normally without any hacks. It might look something like this:
body {
padding-top: 60px;
padding-bottom: 40px;
}
header.global {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 60px;
}
footer.global {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 40px;
}
html, body {
position: fixed;
}
try setting this css property and see if it works.
It solves the elastic scrolling effect on the body.
Sample page
Output to test on ipad

Get Rid of White Space Under Footer On Full Screen Browser And Large (49 inch) Screens

Frankly I have seen and read so many posts on this topic to the point that I almost shied away from asking the question but none has covered the scope of or solved my problem so far.
I get white screen on this website only when I put the browser on full screen (press F11). The space is even worse on large screens such as 49 inch televisions if their browsers are also put to full screen mode. I am using blankslate theme and used elementor plugin to build the site so I dont have an "official" footer per say. How best can I get rid of this because it looks really ugly on huge screens. Solutions such as this one and the like but they dont work including setting the
height: 100vh; //100% /* in custom.css */
Okay a few things:
Your body has margin of 8px on it:
body {
margin: 0;
}
You want to put height: 100vh; on the inner container of the content. It also has margin-top: -1%; for some reason:
.elementor-element-9q9c7yv {
height: 100vh;
margin-top: 0;
}
This fixes everything except there is an empty div on the bottom that is adding 1px of white space to the footer, get rid of it:
elementor-container elementor-column-gap-no {
display: none;
}
There ya go :)
Try:
html, body {
height: 100%;
}
If that doesn't work, you could put this plus the above:
footer {
position: absolute;
bottom: 0px;
left: 0px;
}

div position won't reset in responsive page

I tried to find a solution here but couldn't find it.
I'm working on this responsive design page. On mobile, when you tap menu, the main content div gets pushed aside (via Javascript) to reveal a left-fixed menu underneath. Everything works pretty fine except that when you see the webpage on a computer browser (resided to mimic mobile), open the menu and then expand the browser window till it hits the "desktop" breakpoint, the main content div remains pushed aside.
Is there a way to reset the position of the content (main) div when maximized to the desktop breakpoint? I've tried many alternatives to no avail.
Here's a jsfiddle link with the page: https://jsfiddle.net/luchosoto/wad3pmn0/1/
CSS for the main content div:
#main {
top: 0;
bottom:0;
width: 100%;
position:fixed;
overflow-y:scroll;
-webkit-overflow-scrolling: touch;
overflow-x:hidden;
z-index: 2;
transition: 500ms;
box-sizing: border-box;
}
Javascript that pushes main div aside to show menu:
var counter = 1;
function toggleNav() {
if (counter == 1){
document.getElementById("main").style.transform = "translateX(60%)";
counter = 0;
}else{
document.getElementById("main").style.transform = "translateX(0%)";
counter = 1;
}
}
Thanks in advance.
While Zack Kirby's answer sounds logical and ntgCleaner's comment is very useful, you could also add this CSS which forces the main div position to where you want it: JSFiddle
#media screen and (min-width: 801px) {
#main {
transform: translateX(0) !important;
}
}
Since you are using javascript to move the div, you will also need to use javascript to move it back. You'll need to do that with a window.onresize listener. You can use something like this answer to achieve that.

Unwanted border around background image div

I am getting a slight line or border around my background image. I am dynamically changing the height of the parent div via javascript so that the inner div (which has the background image set) will "stick" to the bottom of the window.
No line appears on the desktop browsers, but on the mobile browser after the script runs, there is usually a thin border around it:
The border is on the left and the way it should be is on the right. Any suggestions?
This is the script:
<script type="text/javascript">
function layoutHandler(){
if(window.innerHeight > 1061){
var newsize = 150 + (window.innerHeight - 1061);
document.getElementById("footerwrapper").style.height = newsize+'px';
}
else {
document.getElementById("footerwrapper").style.height = '150px';
}
}
window.onload = layoutHandler;
window.onresize = layoutHandler;
layoutHandler();
</script>
And then the inner div is setup like so:
#inner {
background-color: #FFF;
padding: 0px;
height: 150px;
bottom: 0px;
width: 100%;
position: absolute;
background-image: url(Images/grad.png);
background-repeat: repeat-x;
}
Edit:
Okay, after testing this a bit more I narrowed down when it happens. (This might get frustratingly specific) It happens most noticeably on the iPad in portrait mode. I turned off the "repeat-x" and it goes away completely. That led me to try a much wider background image which would not be repeating within the width of the iPad and it took away this issue. Any ideas why the heck this is happening?
I had the same problem and removing repeat-x solved it. I think it is bug of phone browsers.

Is there a Vertically Responsive Gallery Plugin? Jquery or Javascript?

Can anyone point me in the direction of a horizontal and vertically responsive gallery slider plugin or Jscript?
I have tried Flexslider1/2, Galleria, various other plugins, but they are all a set width and don't seem to respond to resizing the browser vertically? I have tried changing all the CSS but no luck.
Any help at would be greatly appreciated.
Example (With Flexslider): If you resize the browser horizontally, the images will automatically resize to fit within the browser window. If you resize vertically this will cut off the image vertically.
Aim: When you resize the browser window vertically the image will change width and height to keep ration and fit within the browser window. Same with Horizontal.
Hopefully I have explained this clearly. If you need clarification please ask rather than down voting.
Having a poke around the code in Flexslider I couldn't find anything specifically excluding the possibility of an image resize on vertical window change. The image resize appears to be purely CSS based which then feeds the width/height inforomation into the javascript. It appears you are stuck with a DOM/CSS issue of the browser not resizing an image on a vertical window change and then a little bit of this not being a tested FlexSlider setup.
It'a always been a bit finicky to get all browsers to understand 100% vertical layouts with no vertical scrolling as it's not the normal layout paradigm. Subsequent CSS versions have helped a bit but there's still a big difference between how browsers react and interpret what you mean by 100%.
I took the slider demo and borrowed most of a stack answer to manage the 100% vertical layout and ended up with this with the detail below.
First, change your image CSS properties to scale the height of the layout and set the width auto to keep the correct aspect:
width: auto;
height: 90%;
This works on an image by itself but the FlexSlider javascript adds some extra elements into the page and also defaults some CSS width values in the demo for the horizontal layout.
.flexslider .slides img {width: 100%; display: block;}
becomes
.flexslider .slides { width: 100%; display: block;}
.img {display: block; }
Now you have a slideshow working in Chrome.
Firefox won't apply the images 100% height to the elements containing the like Chrome so I had to step back through all the elements and apply the 100% height rule in CSS
.flexslider .slides {height: 100%; width: 100%; display: block;}
.img {display: block; }
.flex-viewport img{ height: 100%;}
.flex-viewport li { height: 100%;}
.flex-viewport ul { height: 100%;}
.flex-viewport { height: 100%;}
You'll see I did the img there as well. And you end up with the page.
One draw back to this solution is you now have an image that will resize past the horizontal size of the screen. You probably need to build something in to cater for this as you will run into issues if you use the basic carousel which is dependendant on the width to work. Also something funky happens when you mouseOut of the screen adding a horizontal scroll bar but I'll leave that one for you. Also try IE at your own risk.
...and this is why I shy away from front end development =)
Sorry that post ended up being a bit of a running commentary of me poking about.
I also wanted an image slider that was vertically responsive (and horizontally). After not finding anything out-of-the-box that worked they way I wanted I started fiddlin'.
Here's the result.
Here's the key elements (go to the jsFiddle for the full demo). It's not quite perfect but should be enough to get you started.
HTML
<div id="fader">
<img src="http://placehold.it/600x600&text=Slide1" >
<img src="http://placehold.it/600x600&text=Slide2" >
<img src="http://placehold.it/600x600&text=Slide3" >
<img src="http://placehold.it/600x600&text=Slide4" >
</div>
CSS
#fader {
position: relative;
width: auto;
height: 100%;
}
#fader a {
display:block;
width:auto;
height:100%;
}
#media screen and (orientation: portrait) {
img {
width: 100%;
height:auto !important;
}
}
#media screen and (orientation: landscape) {
img {
height: 100%;
min-width:10%;
max-width:100%;
}
}
Special thanks to this jsFiddle for the lightweight jQuery rotator.

Categories