I asked a similar question already, but I'm still having this problem.
The website I made has a bug on tablets. The different content sections don't display properly on tablets - things overlap. The Google Maps iframe, for instance, shows upon page load, not upon clicking on the corresponding radio button (label!). This only happens on tablets.
After some deep thinking, I found that the radio buttons are probably the culprit. On desktops everything looks A-OK.
Sorry, I can't make a JSfiddle to reproduce the tablet issue (help is explicitly sought only from those who can use dev tools, take a quick look and maybe point me to what needs to be done in order to make it work on tablets, in short only from real badass cross-browser Chucknorisses).
Help would be much, much appreciated!
UPDATE:
The radio-buttons I'm talking about are 'design-hidden' to only keep labels as visible / clickable elements.
The code looks like this (this would be the yellow 'home' button):
<div class="mx-button" id="real_button5">
<input type="radio" name="mx" id="button5" checked>
<label for="button5" onclick="" style="background-color: rgba(255,216,0,1);">HOME</label>
</div>
It seems that on tablets, these buttons are clickable (something happens), but they don't unhide the correct content. Things overlap.
As you are already using jQuery within your project I built a small example fiddle for you. Th concept behind it is the following:
All menu buttons have the class menubutton. This gives you the possibility to style the buttons but allows you additionally to use a jQuery selector on them. Further I gave each button a value attribute. This attribute represents the id of the content div which should be shown.
The content divs also have a common class content and an id correspondig to the vlaue attributes above.
<button class="menubutton" value="content1">item1</button>
<button class="menubutton" value="content2">item2</button>
<button class="menubutton" value="content3">item2</button>
<div class="content" id="content1">Content 1</div>
<div class="content" id="content2">Content 2</div>
<div class="content" id="content3">Content 3</div>
Now I use CSS to hide all content divs by default:
.content {
display:none;
}
The JavaScript part is also not that complicated. I add a click-function to each element with the class menubutton. This is done with a jQuery selector. Now all content divs are selected by $(".content") and I hide them with hide().
this.value is the value attribute of the button you clicked on and is used to show this specific content div.
$('.menubutton').click( function() {
$(".content").hide();
$("#" + this.value).show();
});
I hope this shows you some of the jQuery possibilities.
UPDATE
As you want to use divs instead of buttons I made some changes on the example you can see them in this fiddle.
I changed from buttons to divs and added an id to each content div like the following:
<div class="menubutton" id="content1">item1</div>
<div class="menubutton" id="content2">item2</div>
<div class="menubutton" id="content3">item2</div>
<div class="content" id="show_content1">Content 1</div>
<div class="content" id="show_content2">Content 2</div>
<div class="content" id="show_content3">Content 3</div>
the id of content div matches the id of its navigation div plus a standard prefix. show_ in my example. The JS Code was updated to use the id, instead of the value property to find the desired content div:
$('.menubutton').click( function() {
$(".content").hide();
$("#show_" + this.id).show();
});
UPDATE II
To show one content div by default, you can add another css class to this div (see updated fiddle)
<div class="content default_content" id="show_content1">Content 1</div>
I added this corresponding class to the CSS file:
.default_content {
display:block;
}
Related
I'm trying to educate myself about Flickity. The carousel auto plays and the selected cell (denoted by the grey background) is automatically in the middle. I would like the selected cell not to be in the middle. I'm looking for a way to may it be the cell to the left, so it is above the dots (desktop view).
Hope that makes sense. Here is the jsfiddle for it.
The only method that I can think of is using jQuery to find the prev sibling for the "is-selected" class and adding a class to it, but I was hoping there may be a simpler method
Thanks in advance for your feedback!
<div class="carousel-outer-flick">
<div class="carousel-cell"></div>
<div class="carousel-cell"></div>
<div class="carousel-cell is-initial-select"></div>
<div class="carousel-cell"></div>
<div class="carousel-cell"></div>
</div>
add this
<Slider
options {{
cellAlign: 'left' //this part will shift your entire slide to left
}}>
...
I am trying to implement a custom combobox dropdown using angular 4 in my web application.
I have used this custom combobox as one of the field in to list of line items using divs.
Here, I wanna open dropdown in last line item of list, but it exceeds the window screen.
How to make the full dropdown visible to user automatically while opening combobox at the bottom of the page?
<div style="height: 56px; margin-left: 7px; min-width:220px" [style.width]="columnsHeaderWidth.division">
<div style="width:180px; height: 56px; max-width:180px; cursor: pointer;">
<combo-box [id]="'division-'+user.uuid" [userOption]="true" [isSelected]="false"
[magicLabelHack]="'projectTypeLabel'"
[includeMagicLabel]="false"
bind-placeHolder="'Select division/group...'"
icon="wizard:chevrondown"
[source]="divisions" [selectedValue]="user.divisionId" (onSelected)="onChangeDivision($event,user,user.division.id)"
[isIconItemList]="true" [itemListWidth]="'230px'"
[changeStyle]="true"
(click)="rowClick(user)" (onFocusVisible)="tabFocus($event, user)">
</combo-box>
</div>
</div>
Snapshot:
Use a template variable with some vanilla JS calculation :
<div #div style="left: 500px;"></div>
<p *ngIf="div?.getBoundingClientRect().x + div?.getBoundingClientRect().width > totalWidth">
The div is out of bounds
</p>
Stackblitz (change the style.left of the div to see it work)
English is just enough broken so I can't decipher what is it that you exactly want, so I assumed that you wanna scroll to the bottom of that dropdown?
In the screenshot you posted I can see the page scroll bar being near the top, I presume that dropdown stretched the page vertically so the end of it is actually visible.
Under those two assumptions, the simplest vanilla solution is to target the last option in dropdown and scroll to it.
el.scrollIntoView() is a vanilla solution where el is the DOM element you are after.
Description of options available in the documentation here: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
if you have it in Angular4, you can get the DOM element via var el = ang4ele.nativeElement
It is hard to test this to make it bulletproof for your case before posting due to your code being incomplete (showing only the template part).
I've been creating a website thats organized mostly with display:flex. All the content is in one html and using JQ to show() and hide() the different content. Now I'm trying to create a "pop up" window using a div. I initially hide() the popup div. when I click the button(which is a flex item) nothing seems to happen. Its as if the properties of flex are pushing it out of the way. Here is a sample of why my code looks like. Does anybody have experience with this?
<div class="flex-container">
<div class="button"></div>
<div class="button"></div>
<div class="button-to-click"></div>
<div class="popUp"></div>
</div>
$(".popUp").hide();
$(".popUp").click(function () {
$("#wgl-welcome").fadeIn(500);
});
Here is an updated JSFiddle of what I'm trying to accomplish. Of coarse - works in the fiddle haha. Possible something out side the container is effecting it.
https://jsfiddle.net/ab3d/97bcnvnr/5/#&togetherjs=5lME62V5tt
I am working on a video game UI that is built in HTML/CSS/JS (Angular). This question has specifically to do with the chat component of the UI, which is a chat box with an input field and send button on the same line beneath it.
The simplified markup for the input and submit looks like this (removed all the angular markup):
<div class="chat-controls">
<form class="chat-form">
<input type="text" class="chat-input" />
</form>
<a href class="chat-send btn">Send</a>
</div>
Here's the problem I'm trying to solve: our game is localized for many different languages, meaning that the horizontal size of the Send button varies dramatically from one language to the next depending on the translation. Therefore I cannot predict the Send button width. I would like the text input box to fill the remainder of the space horizontally next to the send button (fixed .chat-controls width - variable .chat-send width = .chat-input width).
The tricky part is I'm trying to do this in pure CSS without using JS. I know I can measure .chat-send with JS and assign the width of .chat-input accordingly (or do something like add a CSS class to an ancestor that denotes the language version and hardcode the values for each language in CSS), but the most flexible and maintainable solution would be pure CSS.
This cannot be achieved with floating the send button right, since the text input will then either flow underneath the send button or I need to know the width of the send button to assign right padding on .chat-input to compensate. If calc() could predict the width of a sibling element this would be trivial, but alas it cannot. I played with flexbox for a while as well and it doesn't seem appropriate for this situation. My current fix is to make the send button the width of the maximum size it can currently be (Russian, which is about twice the length of "Send" in English) but this doesn't look too good.
My question is: is there any reasonable way to do this in pure CSS, or do I just need to do it in JS? Note that browser compatibility is not an issue as this is implemented with Chromium Embedded Framework so just about everything is supported.
you can use display with either flex or table.
<h1>display:flex;</h1>
<div class="chat-controls">
<form class="chat-form">
<input type="text" class="chat-input" />
</form>
<a href class="chat-send btn">Send</a>
</div>
<h1>display:table;</h1>
<div class="chat-controls bis">
<form class="chat-form">
<input type="text" class="chat-input" />
</form>
<a href class="chat-send btn">Send</a>
</div>
with this following CSS to test both version
.chat-controls {
display:flex;
}
.chat-form {
flex:1;
}
.chat-input , .bis .chat-form{
width:100%;
}
.btn {
padding:0 1em;
}
.bis {
display:table;
width:100%;
}
.bis .chat-form, .bis .btn {
display:table-cell;
}
You can play with it online here : http://codepen.io/gc-nomade/pen/MYmVZM
float is also an option if you do not mind to put the send link/button ahead in HTML (third exemple in the demo linked).
In my example i have a fixed input data-spy="affix" that is shifted downwards by 90px because of the parent <div class="container" style="margin-top:80px">.
So the only thing that should scroll is the text. This actually works!
My problem is that the text that is scrolled behind the input is visible and i would like to hide it!
I tried to add a white box before the input but all my tries where not really successful!
So i hope you can help me! Thanks
http://bootply.com/113734
in fact #nico-o already gives the answer here. Wrap your input inside a div and apply the affix on this:
<div style="background-color:white;padding-top:80px;" data-spy="affix" data-offset-top="1">
<input class="form-control" id="searchterm" name="tags" placeholder="Input" type="text">
</div>
Doing this you will have the same kind of problem as described here: Bootstrap 3RC1 + Side Panel + Affix.
To solve this add:
$(document).scroll(function(){
$('.affix').width($('.container').width());
});
See: http://bootply.com/113811
#nico-o also suggest a scrollable Text-container, see http://getbootstrap.com/javascript/#scrollspy-examples for an example