Currently, I'm working on a custom AngularJS drop-down, which is represented by the HTML structure below:
<div>
<label></label>
<div>
<a ng-class="{active: popover}">
<div></div> <!-- the selected item -->
</a>
<div style="position: relative;"> <!-- THIS is the div that presents -->
<!-- the list with the menu items-->
<div class="popover" ng-class="{popover-show}">
<input /> <--! this is a search box -->
<ul ng-repeat="item in items">
</ul>
</div>
</div>
</div>
</div>
The rules for .popover and .popover-show are from Twitter Bootstrap but the have the additional rules below:
.popover{
top: 20px;
left: auto;
right: 0;
max-width: none;
border-collapse: separate;
}
.popover.popover-show {
display : block !important;
}
The div with the postition:relative is the one that is wrap
The directive seems to work fine. However, when it's positioned below the middle of the page and it has too many items so it exceeds the window's height by default the vertical scroll of the bar appears. I've been looking to other similar questions, but none of them was close enough to my case. So, my question is what would be the smartest way to detect when I am about to exceed the window height (and of course, the best place to do it - CSS, the directive) and to set the bottom to 0?
Thanks in advance!
UPDATE: I'm trying to get around without using jQuery and the JS files for Twitter Bootstrap
use the data-placement=" " identifier
this is how to do it for a popover:
HTML
Click
JS
<script>
$(document).ready(function(){
$('[data-toggle="popover"]').popover();
});
</script>
For dropdowns this will work, to change from dropping down to dropping up,
HTML
<div class="dropup">
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
</div>
Related
For some reason, when i add the 'top: xxx' property in css my button becomes unclickable, and i cant position it correctly. It was working fine before. I have it set up to run joyride onclick, which is a foundation plug in. Not sure whats going on. Here's my html, and link to the site, please inspect element to see code www.omegadesignla.com:
<div class="container">
<header>
<div class="row">
<div class="large-3 small-centered columns"> <!-- large centered -->
<a id="topbutton" class="button large radius button">Take the tour!</a>
</div>
</header>
Here is my css:
#topbutton{
position: relative;
top: 125px;
}
your just missing an href attribute inside the
try this
<a id="topbutton" href="#" class="button large radius button">Take the tour!</a>
I'm currently trying to break a child element out of it's parent which holds overflow: hidden.
The reason for me restricting the dimensions of it's parent are purely for a JavaScript hack. I have tried positioning the child however this still breaks the pages structure and position fixed will be uneffective.
This is the closest I have got so far to achieving this:
<div style="position: relative;">
<div>
<!-- Needs to be overflow hidden and 0 width -->
<ul style="overflow: hidden; width: 0px; height: 0px;">
<li>
<!-- Needs to be visible -->
<div style="position: absolute; top: 0px; left: 0px;">
Tab Content
</div>
</li>
</ul>
</div>
</div>
http://jsfiddle.net/0uwv3nyj/
Does anyone know any kind of css hack or workout to solve this while retaining a standard block display to the element?
Thanks,
Simon
I'm not sure I fully understand your question, but try setting the ul visibility to hidden and the div visibility to visible:
ul --> style="visibility:hidden; height:0;"
div --> style="visibility: visible;"
I want to move or replace .pac-container, the problem is that pac-container is somwhere in deep in my HTML and i want to move whole div to my bootstrap modal, how can i do it?
<div class="pac-container" style="display: none;"></div>
My HTML
<body>
<div class="modal">
<input name="adress"></input>
<!-- I want to move container right here -->
</div>
<div class="container">
Blaaa
</div>
<!-- Concurent position of pac container -->
<div class="pac-container" style="display: none;"></div>
May I guess that the main issue is that the autocomplete-input is placed in the modal and the suggestions(placed in the .pac-container) will appear behind the modal?
When yes: moving the .pac-container wouldn't help here, the result would be a incorrect position.
Try using a z-index for the .pac-container that is higher than the modal's z-index(currently it's 1050)
<style>
.pac-container{z-index:1051;}
</style>
I am using twitter bootstrap , below is a certain portion of my code . Whenever the affix gets applied after scrolling down , the whole div resizes . What am i doing wrong ?
<div class="mythumb" data-spy="affix" data-offset-top="90">
<img src={$profimg_src} style="width:100%;" data-src="holder.js/300x200"/>
<div class="caption">
<h5>{$firstname}{$middlename}{$lastname}</h5>
</div>
<div class="btn-group">
<button class="btn" id="subscribe">Subscribe</button>
<button class="btn dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<!-- dropdown menu links -->
<li>Subscribe To All posts</li>
<li>Subscribe To Ideas Only</li>
<li>Subscribe To Posts Only</li>
</ul>
</div>
</div>
When using affix, the JS will add the class of affix to the div that its spying on once you have scrolled 90px (in this case).
When it does this it takes the div out of normal flow so you typically have to create a new style for the the affixed div.
Something like this is a start:
.mythumb.affix{
top:50px;
margin: 0 auto;
width:940px;
height:200px;
}
You might also have to specify z-index and position values. I don't know what your current page looks like, so the CSS above is just a guess. Once you understand that the root cause is because the affixed div has been taken out of normal flow, you can usually restyle it to suit your purpose.
Hope this helps!
I'm having a layout issue with my jQuery-Mobile site which only began occurring after updating Google Chrome to version 26. The basic layout of my page is as follows: two panes, "desktopSideBar" and "desktopContentPane", each containing their own header.
<div data-role="page" data-theme="b" position="fixed">
<div id="desktopSideBar">
<div id="mobile_navigation_content">
<div class="ui-bar-a ui-header" data-position="inline" id="navigationHeader">
<a class="ui-btn-left" data-icon="back" data-iconpos="notext" data-inline="true" data-mini="true" data-role="button" data-theme="b"></a>
<h4>First Header</h4>
</div>
</div>
</div>
<div id="desktopContentPane">
<div class="ui-bar-a ui-header" data-position="inline" id="contentToolbar">
<a class="ui-btn-left" data-icon="arrow-l" data-inline="true" data-mini="true" data-role="button" data-theme="b">Hide</a>
<h4>Second header</h4>
<a class="ui-btn-right" data-icon="gear" data-iconpos="notext" data-inline="true" data-mini="true" data-role="button" data-theme="b"></a>
</div>
</div>
</div>
Obviously, this type of thing isn't exactly built-in to the jQM framework, so I had to add some javascript code for properly positioning and resizing the panes and their headers.
This fiddle shows a simplified version of my page.
The issue is in the header on the right, where the header's title and rightmost button are stacked on its left side. Opening the fiddle in Firefox or IE will show the desired layout.
The strange thing is, Chrome still seems to know where the elements should be. Clicking on the button with the gear icon will instantly make it go to the right, and if you right-click the header and choose "Inspect element", you can make the whole header bar fix itself by unchecking and checking some of the css styles on the <div class="ui-header"> tag.
What I'm looking for is firstly, any idea what might have changed in Chrome v.26 which could cause this, as this would help me get to the root of the problem.
I also wouldn't mind if someone actually knows what the root of the problem is, as currently my workaround is to add this into the resizing code:
setTimeout(function () {
$("#contentToolbar").removeClass("ui-header").find("h4").css("text-align", "left");
setTimeout(function () {
$("#contentToolbar").addClass("ui-header").find("h4").css("text-align", "center");
}, 5);
}, 500);
... which causes a noticeable flicker when the elements are repositioned.
Thanks!
Based on your comments, here is an example on ui-grid.
Note: Tested on Chrome Version 26.0.1410.43.
Working Demo
<div class="ui-grid-a">
<div class="ui-block-a">
<div data-role=header data-theme=b>
<a href=# data-role=button data-icon=back data-iconpos=notext>g</a>
<h6>header</h6>
<a href=# data-role=button data-icon=gear data-iconpos=notext>g</a>
</div>
<div data-role=content>contents</div>
</div>
<div class="ui-block-b">
<div data-role=header data-theme=e>
<a href=# data-role=button data-icon=arrow-l data-iconpos=notext>g</a>
<h6>header</h6>
<a href=# data-role=button data-icon=star data-iconpos=notext>g</a>
</div>
<div data-role=content>contents</div>
</div>
</div>
CSS
.ui-block-b {
width: 25% !important;
height: 100% !important;
}
.ui-block-a {
width: 75% !important;
height: 100% !important;
border-right: solid 1px #ff0000 !important;
}