Is there is any layout like this
http://layout.jquery-dev.net/samples/gispaho/layoutintab.htm which suport google map as a contend i use the above one. i got a problem, splitter drag fails over the google map.
Ref
https://stackoverflow.com/questions/15795815/jquery-dragable-fails-over-the-google-map
what i tried is
<div id="layout" class="sun-layout" style="height: 600px;">
<div class="ui-layout-west sun-layout">
<div class="map1">
</div>
</div>
<div class="ui-layout-center sun-layout">
<div class="map2">
</div>
</div>
in Dom ready
var $layout = $("#layout"); $layout.layout({
west__size: 400 });
We had the same problem in our application. We just show an invisible div over the map on the start of the resize and hide it at the end. That div will temporarily stop all mouse events from reaching the map. I imagine the same technique will work on your other question. As long as there is some way to hook into the resize start and resize end events, this should be effective.
So to apply it to your situation I would alter the html as such:
<div id="layout" class="sun-layout" style="height: 600px;">
<div class="ui-layout-west sun-layout">
<div class="map-mask"></div> <!-- Your map mask -->
<div class="map1">
</div>
</div>
<div class="ui-layout-center sun-layout">
<div class="map-mask"></div> <!-- Your map mask -->
<div class="map2">
</div>
</div>
Then I would add the following events to jquery UI layout:
.layout({
...
onresize_start: function(){
$(".map-mask").show();
},
onresize_end: function(){
$(".map-mask").hide();
},
...
})
And some CSS. I don't know what context the sizing is for map, so you will need to tailor this. The idea is to get the div in a z-index higher than the map and cover it completely.
.map-mask{
height:100%;
width:100%;
position: absolute;
z-index: 1000;
}
Related
I have a webpage that shows an image up to size 400x400px, if they click on the image then I want it to display in a modal that sizes to accommodate the actual size of the image
The modal comes up but it defaults to 500px whatever the size of the image (from https://getbootstrap.com/docs/5.2/components/modal/#fullscreen-modal). If the image is larger than that I want the modal to be larger, and if smaller I want the modal to be smaller, I cannot see how to do this. I notice you can also have a fullscreen image by using modal-fullscreen but that doesn't help me.
Surely possible for the modal to size to accommodate the data
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<div>
<a data-bs-toggle="modal" data-bs-target="#full_size_image_dialog">
<img src="https://via.placeholder.com/400" class="figure-img img-fluid border border-dark">
</a>
<div id="full_size_image_dialog" class="modal">
<div class="modal-dialog modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h5>
Full Size artwork
</h5>
</div>
<div class="modal-body">
<img src="https://via.placeholder.com/500" class="figure-img img-fluid border border-dark">
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
Edit
So I went though the answers at How to resize Twitter Bootstrap modal dynamically based on the content
The only answer that sort of worked was adding style="max-width : 1200px;"to the div with bootstrap class of modal-dialog
<div id="full_size_image_dialog" class="modal">
<div class="modal-dialog modal-dialog-scrollable" style="max-width : 1200px;">
<div class="modal-content">
<div class="modal-header">
<h5>
Full Size artwork
</h5>
</div>
<div class="modal-body">
<img src="http://172.17.22.1:9790/minimserver/*/Music/PopRock/Lily*20Allen/Alright,*20Still/01*20-*20Smile.wav/$!picture-34755692-444226.jpg" class="figure-img img-fluid border border-dark">
<figcaption>
1200 x 1200
</figcaption>
</div>
</div>
</div>
</div>
The trouble is that if the actual height of the image is larger than the height of the browser window then the image has to be scrolled vertically
What I actually want is the full image to be displayed full size but only if enough room in browser, otherwise display the max size it can be displayed without vertical scrolling. I can set a lower value for max-width so it works on my window, but then that is not going to be great for users with bigger resolution windows.
It does handle preventing sideways scrolling okay, so if the width of window is too small to show whole image it will shrink image accordingly, and we can reasonably assume images will usually be square.
So my attempted solution was to use Bootstraps container system to set different max-width size for different screen widths using col-md, col-xl ectera. But the trouble is it seems from the help that modal windows need to use their own container within the modal-body div but this isn't going to help because the max-width style has to be applied at the modal div so is outside of modal-body scope.
I tried just utilising the main page container, but it just uses the first dialog code each time, i.e it never uses more than 700px max width
<div class="row g-0">
<div class="col p-2">
<div id="full_size_image_dialog" class="modal">
<div class="modal-dialog modal-dialog-scrollable" style="max-width : 700px;">
<div class="modal-content">
<div class="modal-header">
<h5>
Full Size artwork
</h5>
</div>
<div class="modal-body">
<img src="http://172.17.22.1:9790/minimserver/*/Music/PopRock/Lily*20Allen/Alright,*20Still/01*20-*20Smile.wav/$!picture-34755692-444226.jpg" class="figure-img img-fluid border border-dark">
<figcaption>
1200 x 1200
</figcaption>
</div>
</div>
</div>
</div>
</div>
<div class="col-md p-2">
<div id="full_size_image_dialog" class="modal">
<div class="modal-dialog modal-dialog-scrollable" style="max-width : 1200px;">
<div class="modal-content">
<div class="modal-header">
<h5>
Full Size artwork
</h5>
</div>
<div class="modal-body">
<img src="http://172.17.22.1:9790/minimserver/*/Music/PopRock/Lily*20Allen/Alright,*20Still/01*20-*20Smile.wav/$!picture-34755692-444226.jpg" class="figure-img img-fluid border border-dark">
<figcaption>
1200 x 1200
</figcaption>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row g-0">
<div class="col-7 col-md-6 col-lg-4 col-xl-3 p-2">
<a data-bs-toggle="modal" data-bs-target="#full_size_image_dialog">
<img src="http://172.17.22.1:9790/minimserver/*/Music/PopRock/Lily*20Allen/Alright,*20Still/01*20-*20Smile.wav/$!picture-34755692-444226.jpg" class="img-fluid border border-dark">
</a>
</div>
At the moment, this is the best solution I could come up with using only CSS:
.modal-dialog {
max-width: max-content !important;
}
.modal-body {
display: flex;
}
.modal-body img {
object-fit: contain;
}
Only problem is that white bars appear to the left and right of the image when screen height is less then image height.
This is because of the object-fit: contain; style which I added to the image to maintain the original aspect ratio. If you remove this style then then white bars will disappear but the image will not keep it's initial aspect ratio when it's height is shrinking.
JS Fiddle: https://jsfiddle.net/hvaosw5j/
At the moment my mobile app looks similar to the one on the link below:
http://jsfiddle.net/TM6Dt/
with the following code:
<body>
<div data-role="page">
<div data-role="header">
<h1 data-inline="true">Demo Page</h1>
Mail
Settings
</div>
<div data-role="content" class="content">
<p>Demo Page</p>
</div>
</div>
</body>
What I'd like to do is have both of the circular buttons on the right side of the header bar. I've tried putting them in a controlgroup div but for some reason this changes them so they are no longer circular - I get square buttons with the icons in the middle. What's worse is they are not even aligned properly! You can see what I mean here:
http://jsfiddle.net/Gd8ZB/
and the code:
<body>
<div data-role="page">
<div data-role="header">
<h1 data-inline="true">Demo Page</h1>
<div data-role="controlgroup" class="ui-btn-right">
Mail
Settings
</div>
</div>
<div data-role="content" class="content">
<p>Demo Page</p>
</div>
</div>
</body>
How do I get around this problem? Any help would be appreciated!
I've done that as follows:
<div class="ui-btn-right">
Mail
Settings
</div>
Fiddle
http://jsfiddle.net/TM6Dt/1/
one way to do it is to change position of the first button in first example and move it to the right with following css
style="right: 40px; left: initial;"
I am using google charts with twitter bootstrap in rails application.
In fluid layout if the span width decreases, the chart overflows its parent div.
Can google chart width be given in percentages?
Please help.
Update
I am using google_visualr gem.
Here is my controller code.
def home
# Indents
indent_status_table = GoogleVisualr::DataTable.new
indent_status_table.new_column('string', 'STATUS')
indent_status_table.new_column('number', 'COUNT')
indent_status_table.add_rows(1)
indent_status_table.set_cell(0, 0, 'Open')
indent_status_table.set_cell(0, 1, 100)
opts = { :title => 'INDENT STATUS', :is3D => true }
#indent_status_chart = GoogleVisualr::Interactive::PieChart.new(indent_status_table, opts)
end
And here is my html.erb code
<div id='shipment_status_chart' style="width:100%; height:200px"></div>
<%= render_chart #shipment_status_chart, 'shipment_status_chart' %>
And in java script code.
$(function() {
$(window).resize(function(){
drawChart();
});
});
You can specify the chart width in the HTML
<div id="chart_div" style="width:100%; height:300px"></div>
From Google Charts documentation:
Specifying the size in HTML - A chart can take a few seconds to load
and render. If you have the chart container already sized in HTML, the
page layout won't jump around when the chart is loaded.
Here is a Fiddle showing 100% width.
Update
To resize the chart when the window changes size, you can use jQuery to update the chart size.
$(document).ready(function () {
$(window).resize(function(){
drawChart();
});
});
Here is a Fiddle showing 100% width with update on screen resize.
I'm using Google Charts with ng-google-chart.js and in order to make my charts responsive I've added style="max-width:100%"
Example:
<div class="row">
<div class="col-md-3">
<div google-chart style="max-width:100%" chart="chart"/>
</div>
<div class="col-md-3">
<div google-chart style="max-width:100%" chart="chart"/>
</div>
<div class="col-md-3">
<div google-chart style="max-width:100%" chart="chart"/>
</div>
<div class="col-md-3">
<div google-chart style="max-width:100%" chart="chart"/>
</div>
</div>
I have the following view:
<aside id="key-panel" class="ui-widget-content">
<h3 class="ui-widget-header">Resizable</h3>
</aside>
I'm injecting the above view into the main html file using durandal.js. So when the view is attached, i execute the following code:
$('#key-panel')
.resizable({
handles: 'w',
animate: true,
start: function (e, ui) {
},
resize: function (e, ui) {
console.log('resizing');
},
stop: function (e, ui) {
}
})
When trying to resize the container i can see the mouse cursor being changed, as well as the resize event being fired; However, the actual container doesn't change its size.
Below is the Html that is created by durandal and jquery ui
<div class="durandal-wrapper" data-view="views/keyPanel" data-active-view="true">
<aside id="key-panel" class="ui-widget-content ui-resizable ui-draggable"style="position: absolute; top: 80px; left: auto;">
<h3 class="ui-widget-header">Resizable</h3>
<div class="ui-resizable-handle ui-resizable-w" style="z-index: 90;"></div></aside>
</div>
I've noticed that the aside element doesn't have the width property in the style attribute.
Does anyone know what i'm doing wrong. I tried to make the container draggable and it worked, it's only the resizable functionality that is not doing anything.
I am not sure about your problem, but I recommend you to put a extra div in all your views. I don't know why, but during the composition some styles are changed. Maybe, adding a extra div in the template can solve your problem.
<div>
<aside id="key-panel" class="ui-widget-content">
<h3 class="ui-widget-header">Resizable</h3>
</aside>
</div>
I hope this will help you.
I'm working on a website which requires a chunk of code, the nature of which is proving to greatly exceed my limited knowledge of JQuery. The structure of the site is as follows (not quite sure if this is optimally structured for what needs to be done with it, JQuery-wise):
<script>
$(function() {
$(".menutype,.contenttype").draggable({revert:true});
$(".content").droppable({accept:".menutype,.contenttype"});
$(".content").droppable({
drop:function(event,ui){
$(this)
$('div.content').attr('id', 'contenthover')
.find( "p" )
.html( "Droppped!" );
}
});
});
</script>
<body>
<div class="header"><p>///HEADER///</p></div>
<div class="container">
<div class="wrapper1">
<div class="wrapper2">
<div class="content">
<p>///CONTENT///</p>
</div><!-- END "content" -->
<div class="menuL">
<div class="menutype-container">
<div class="menutype"></div>
<div class="menutype"></div>
<div class="menutype"></div>
<div class="menutype"></div>
</div><!-- END "menutype-container" -->
</div><!-- END "menuL" -->
<div class="menuR">
<div class="contenttype-container">
<div class="contenttype"></div>
<div class="contenttype"></div>
<div class="contenttype"></div>
<div class="contenttype"></div>
</div><!-- END "contenttype-container" -->
</div><!-- END "menuR" -->
</div><!-- END "wrapper2" -->
</div><!-- END "wrapper1" -->
</div><!-- END "container" -->
<div class="footer"><p>///FOOTER///</p></div>
</body>
The basic premise is that once one of the "menutype" DIVs is dropped within the droppable area, a corresponding menu structure is revealed in the content DIV. Similarly, once dropped, "contenttype" shows the inline content within that menu.
At this point i'm stumped as to how I go about achieving this. My main problem is that I do not know how to differentiate the menu and content types within the .droppable, as I only know how to define which items it accepts, and not what to individually do with draggable items.
I'm not expecting someone to spit out the necessary code, but some pointers or examples would be greatly appreciated.
I see a lot of people try and use draggable/droppable when what they really need is sortable. Menus are usually unordered lists. Try converting your
<div class="menuL">
into
<ul class="menuL">
with all the
<div class="menutype"></div>
changed to
<li class="menutype"></li>
with this js code
$(".menuL").sortable({
items : 'li',
connectWith : '.menuR',
update : function(event, ui){
},
recieve : function(event, ui){
}
});
if you want to drag and drop between menus you could use common class for both ul elements