Responsive wont stay inside the main div - responsive-design
How can I make the responsive carousel stay inside the div of the bit I have jssor slider in?
On my site I have jssor slider carousel inside another div but when resizing the page or testing it in a responsive tester the carousel flows over the div it is in.
AS requested the html and java is bellow
<article class="tz-post tz-article">
<div class="tz-postmetadataheader">
<h2 class="tz-postheader">Featured Auctions</h2></div>
<div class="tz-postcontent tz-postcontent-0 clearfix">
<div class="tz-content-layout">
<div class="tz-content-layout-row">
<div class="tz-layout-cell layout-item-0" style="width: 100%">
<script>
jQuery(document).ready(function ($) {
var options = {
$AutoPlay: true, //[Optional] Whether to auto play, to enable slideshow, this option must be set to true, default value is false
$AutoPlaySteps: 4, //[Optional] Steps to go for each navigation request (this options applys only when slideshow disabled), the default value is 1
$AutoPlayInterval: 4000, //[Optional] Interval (in milliseconds) to go for next slide since the previous stopped if the slider is auto playing, default value is 3000
$PauseOnHover: 1, //[Optional] Whether to pause when mouse over if a slider is auto playing, 0 no pause, 1 pause for desktop, 2 pause for touch device, 3 pause for desktop and touch device, 4 freeze for desktop, 8 freeze for touch device, 12 freeze for desktop and touch device, default value is 1
$ArrowKeyNavigation: true, //[Optional] Allows keyboard (arrow key) navigation or not, default value is false
$SlideDuration: 160, //[Optional] Specifies default duration (swipe) for slide in milliseconds, default value is 500
$MinDragOffsetToSlide: 20, //[Optional] Minimum drag offset to trigger slide , default value is 20
$SlideWidth: 175, //[Optional] Width of every slide in pixels, default value is width of 'slides' container
//$SlideHeight: 190, //[Optional] Height of every slide in pixels, default value is height of 'slides' container
$SlideSpacing: -9, //[Optional] Space between each slide in pixels, default value is 0
$DisplayPieces: 4, //[Optional] Number of pieces to display (the slideshow would be disabled if the value is set to greater than 1), the default value is 1
$ParkingPosition: 0, //[Optional] The offset position to park slide (this options applys only when slideshow disabled), default value is 0.
$UISearchMode: 1, //[Optional] The way (0 parellel, 1 recursive, default value is 1) to search UI components (slides container, loading screen, navigator container, arrow navigator container, thumbnail navigator container etc).
$PlayOrientation: 1, //[Optional] Orientation to play slide (for auto play, navigation), 1 horizental, 2 vertical, 5 horizental reverse, 6 vertical reverse, default value is 1
$DragOrientation: 1, //[Optional] Orientation to drag slide, 0 no drag, 1 horizental, 2 vertical, 3 either, default value is 1 (Note that the $DragOrientation should be the same as $PlayOrientation when $DisplayPieces is greater than 1, or parking position is not 0)
$BulletNavigatorOptions: { //[Optional] Options to specify and enable navigator or not
$Class: $JssorBulletNavigator$, //[Required] Class to create navigator instance
$ChanceToShow: 2, //[Required] 0 Never, 1 Mouse Over, 2 Always
$AutoCenter: 1, //[Optional] Auto center navigator in parent container, 0 None, 1 Horizontal, 2 Vertical, 3 Both, default value is 0
$Steps: 4, //[Optional] Steps to go for each navigation request, default value is 1
$Lanes: 1, //[Optional] Specify lanes to arrange items, default value is 1
$SpacingX: 0, //[Optional] Horizontal space between each item in pixel, default value is 0
$SpacingY: 0, //[Optional] Vertical space between each item in pixel, default value is 0
$Orientation: 1 //[Optional] The orientation of the navigator, 1 horizontal, 2 vertical, default value is 1
},
$ArrowNavigatorOptions: {
$Class: $JssorArrowNavigator$, //[Requried] Class to create arrow navigator instance
$ChanceToShow: 1, //[Required] 0 Never, 1 Mouse Over, 2 Always
$AutoCenter: 2, //[Optional] Auto center navigator in parent container, 0 None, 1 Horizontal, 2 Vertical, 3 Both, default value is 0
$Steps: 4 //[Optional] Steps to go for each navigation request, default value is 1
}
};
var jssor_slider1 = new $JssorSlider$("slider1_container", options);
//responsive code begin
//you can remove responsive code if you don't want the slider scales while window resizes
function ScaleSlider() {
var parentWidth = $('#slider1_container').parent().width();
if (parentWidth) {
jssor_slider1.$ScaleWidth(parentWidth);
}
else
window.setTimeout(ScaleSlider, 30);
}
ScaleSlider();
if (!navigator.userAgent.match(/(iPhone|iPod|iPad|BlackBerry|IEMobile)/)) {
$(window).bind('resize', ScaleSlider);
}
//if (navigator.userAgent.match(/(iPhone|iPod|iPad)/)) {
// $(window).bind("orientationchange", ScaleSlider);
//}
//responsive code end
});
</script>
<!-- Jssor Slider Begin -->
<!-- You can move inline styles to css file or css block. -->
<div id="slider1_container" style="position: relative; top: 5px; left: 1px; width: 660px; height: 230px; overflow: hidden;">
<!-- Loading Screen -->
<div u="loading" style="position: absolute; top: 0px; left: 0px;">
<div style="filter: alpha(opacity=70); opacity:0.7; position: absolute; display: block;
background-color: #000; top: 0px; left: 0px;width: 100%;height:100%;">
</div>
<div style="position: absolute; display: block; background: url(../img/loading.gif) no-repeat center center;
top: 0px; left: 0px;width: 100%;height:100%;">
</div>
</div>
<!-- Slides Container -->
<div u="slides" style="cursor: pointer; position: absolute; left: 1px; top: 0px; width: 660px; height: 240px; overflow: hidden;">
<!-- BEGIN featured -->
<div>
<div class="tz-featured-wrapper">
<div style="display:block;" align="center">{featured.TITLE}</div>
<div style="display:block;" align="center"><img src="{featured.IMAGE}" style=" border: 1px solid #9ec9ec;" class="tz-rounded-top tz-rounded-bottom"></div>
<div style="display:block;" align="center">{featured.BID}</div>
</div>
</div>
<!-- END featured -->
</div>
<!-- Bullet Navigator Skin Begin -->
<!-- bullet navigator container -->
<div u="navigator" class="jssorb03" style="position: absolute; bottom: 5px; right: 6px;">
<!-- bullet navigator item prototype -->
<div u="prototype" style="position: absolute; width: 21px; height: 21px; text-align:center; line-height:21px; color:#000000; font-size:12px;"><NumberTemplate></NumberTemplate></div>
</div>
<!-- Bullet Navigator Skin End -->
<!-- Arrow Navigator Skin Begin -->
<!-- Arrow Left -->
<span u="arrowleft" class="jssora03l" style="width: 55px; height: 55px; top: 100px; left: 8px;">
</span>
<!-- Arrow Right -->
<span u="arrowright" class="jssora03r" style="width: 55px; height: 55px; top: 100px; right: 8px">
</span>
<!-- Arrow Navigator Skin End -->
</div>
<!-- Jssor Slider End -->
</div>
</div>
</div>
</div>
</article>
I guess you scale the slider base on window width.
Let's scale the slider base on parent width then.
See
function ScaleSlider() {
var parentWidth = $('#slider1_container').parent().width();
if (parentWidth) {
jssor_slider1.$ScaleWidth(parentWidth);
}
else
window.setTimeout(ScaleSlider, 30);
}
Related
Blueimp Gallery inside Boostrap Modal not vertical aligned properly
I have a modal window that shows a few data that also has Images which open in Blueimp gallery. The problem I have is, when the image is opened in BlueImp gallery, the image is not vertically aligned in the middle of the screen. Its either to the bottom or to the top and it depends on where I have scrolled in the modal window. I need to go to the middle of the modal window and open the gallery in which case the Lightbox looks centered. This issue doesnt happen when blueimp is used directly in the page without a modal. It appears the blueimp gallery's lightbox is centered to the whole modal height instead of the viewport height. How can I override that for blueimp inside modal windows only? Is there a css fix or js fix to override this when blueimp is used in boostrap modals? Here is a sample of my set-up: <div uib-modal-window="modal-window" class="modal fade" role="dialog" size="xl" index="0" animate="animate" ng-style="{'z-index': 1050 + $$topModalIndex*10, display: 'block'}" tabindex="-1" uib-modal-animation-class="fade" modal-in-class="in" modal-animation="true" style="z-index: 1050; display: block;"> <div class="modal-dialog modal-xl"> <div class="modal-content" uib-modal-transclude=""> <div class="lightBoxGallery"> <a ng-repeat="image in vm.ngModel" ng-href="{{::vm.imageurl(image.name)}}" data-gallery=""> <img ng-src="{{::vm.getImage(image.name)}}" class="img-responsive img-thumbnail animated fadeIn"> </a> <div id="blueimp-gallery" class="blueimp-gallery"> <div class="slides"></div> <h3 class="title"></h3> <a class="prev">‹</a> <a class="next">›</a> <a class="close">×</a> <a class="play-pause"></a> <ol class="indicator"></ol> </div> </div> </div> </div> </div> My set-up: Angular 1.5 + Bootstrap 3 + Bootstrap UI + BlueImp Gallery UPDATE: The problem I am having here is, my Bootstrap Modal window has overflow-y as scrollable and it has a fixed positioning: .modal-open .modal { overflow-x: hidden; overflow-y: auto; } .modal { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1050; display: none; overflow: hidden; -webkit-overflow-scrolling: touch; outline: 0; } And when the blueimp-gallery is opened, as a child div with fixed position, it is positioning the Div to the center of the parent's fixed position instead of center of the viewport: .blueimp-gallery { position: fixed; z-index: 999999; overflow: hidden; background: #000; background: rgba(0,0,0,.9); opacity: 0; display: none; direction: ltr; -ms-touch-action: none; touch-action: none; } The blueimp-gallery is aligning to the middle, but I dont want it aligning to the middle of parent (modal) div. I want it aligned to the middle of viewport. For example, in my laptop, my modal has a height of 2000px where as my viewport height is a lot less like 860px. That is why the gallery lightbox is opening either to the top or bottom of the viewport unless the user is right in the middle of the modal window. If I place the blueimp-gallery directly in the body without the modal window, I dont have this issue. But in this use case, I have to place the blueimp-gallery inside a Modal window that has variable height depending on the dynamic content loaded in it. I am still stuck on this, does anyone have a suggestion to this problem please?
The only way I was able to resolve this issue was to pull the "#blueimp-gallery" element out of the Modal Window and then insert it again as a direct child of the body element. Using Jquery, I added this code that fixed the issue: $(document).ready(function(){ $("#blueimp-gallery").prependTo($("body")); }); Now, after the above code, the BlueImp Gallery's fixed position is relative to the body element and therefore the height is that of the viewport. The Modal height no longer affects the BlueImp Gallery's height since it is now placed as a direct child of body element.
You should try to put the blueimp in a div with the class row and then another div with the class col-md-6 not 100% sure but it should be alligned in the middle then. <div class="container"> <div class="row"> <div class="col-md-6"> <div id="blueimp-gallery" class="blueimp-gallery vcenter "> ... </div> </div> </div> Edit tried it it has to have container tag above it to. most likely this is not the sollution to getting it to the center vertically but this is worth a try i guess ADDITION .vcenter { display: inline-block; vertical-align: middle; float: none; } create a costum tag add it in a css file and call on it.
When moving a div with ngAnimate, how can I move adjacent divs smoothly?
I have two divs side-by-side (inline block). Using Angular's ngAnimate, I want the left div to slide off the screen and the right div to slide over and take it's place. Right now what happens is the left div slides away, and once that animation completes, the right div jumps over to take it's spot. How do I make it slide over smoothly at the same time? Here's a Plunker which demonstrates it a lot better than I can explain it: https://plnkr.co/edit/ZrtPPkXlttih15ISgEhk Here's the css/html: Css: .well{ overflow-x: hidden; overflow-y: hidden; } .column{ display: inline-block; width: 100px; vertical-align: top; transition: all linear 1.0s; left: 0px; position: relative; opacity: 1; } .column.ng-hide{ left: -200px; opacity: 0; } Html: <div> <button ng-click="hide = !hide">Toggle</button> </div> <div class="well"> <div ng-hide="hide" class="column" style="background-color: lightblue; height: 150px;"> </div> <div class="column"> This column does not move smothly as the column to the left slides offscreen. </div> </div> Here's that Plunker again, in case you scrolled to the bottom looking for the Plunker link :) https://plnkr.co/edit/ZrtPPkXlttih15ISgEhk
You simply need to change the width of the column in your transition: PLUNKR .well{ overflow-x: hidden; overflow-y: hidden; } .column{ display: inline-block; width: 100px; vertical-align: top; transition: all ease-in-out 1.0s; left: 0px; position: relative; opacity: 1; } .column.ng-hide{ width: 0; left: -200px; opacity: 0; } The reason it wasn't working for you, is due to the fact that the width is remaining the same until the div becomes hidden. This prevents the right column from sliding over as the left column slides out of view. By setting the transition to adjust the width, you can give it that "sliding" effect along the right-edge. I also changed the animation from linear to ease-in-out to give it a nicer transition
How do I make this div responsive in height?
How do I make this div responsive in height ? <style> .full1 { margin-bottom: 10px; margin-top: 10px; width: 100%; height: 225px; } .left1, .middle1, .right1 { float: left; width: 33%; height:100%; } </style> <body> <div class="full1"> <div class="left1" > <img class="left-image" src="http://s16.postimg.org/nc57l3p8l/1_screen_shot_2014_08_24_at_12_43_26_pm_medium.jpg" /> </div> <div class="middle1"> <img class="left-image" src="http://s16.postimg.org/wl7dv7y4l/windows_9_logo_01_medium.jpg" /> </div> <div class="right1"> <img class="right1-image" src="http://s16.postimg.org/ig6675eh1/windows_9_logo_08_medium.jpg" /> </div> </div> </body> Here is the fiddle: http://jsfiddle.net/k07gg3pv/. The images get resized by width but the height leaves large blank space when zoomed.
You have to set the width / height for the images: .full1 img { width: 100%; height: 100%; } (here is your fiddle for that: http://jsfiddle.net/k07gg3pv/3/) This will make the images fit exactly. But this isn't a good solution because your images won't have the proportions they should have. So you have to decide whether you want to fit exactly 100% in width or exactly the height, you won't get proper images and both. So you have to set one value (width or height) for the images: .full1 img { width: 100%; } (here is your fiddle for that: http://jsfiddle.net/k07gg3pv/4/)
Update method bug in extjs
In my extjs project, I have some panel's to which I am showing toolbar on mouseEnter event. This is working fine. But when I just update the panel with new html then the mouseenter event is not working on it. panel.update('hello'); Then I realised through Chrome developer tool that the update method is erasing the last nested div inside panel before writing the new text to it (ie 'hello'). Each panel has 3/4 nested div's but when we use update(), the panel has only 2 nested div's? This was the main reason which was not invoking the mouseenter event on the panel because I think the Ext is unable to identify the panel as a valid panel after update() method. Anyway, later I solved this issue by checking the panel variable in chrome console like below. panel.body.dom.childNodes[0].children[0].childNodes[0].data = 'hello'; The above implementation looks disgusting but it worked for me. Any other nice way to do this? Edit : //In controller this.control({ '#monthCalendar>panel>panel': { render: function(container){ container.on('mouseenter',function(){ //do something here },container,{element: 'el'}); } } }) Before Update: <div class="x-panel x-box-item x-panel-default" id="panel-1078" style="left: 870px; top: 0px; margin: 0px; width: 174px; height: 52px;"> <div id="panel-1078-body" class="x-panel-body x-panel-body-default x-panel-body-default x-box-layout-ct" style="width: 174px; height: 52px; left: 0px; top: 0px;"> <div id="panel-1078-innerCt" class="x-box-inner " role="presentation" style="height: 50px; width: 172px;"> <div id="panel-1078-targetEl" style="position: absolute; width: 172px; left: 0px; top: 0px; height: 1px;"> March 01 </div> </div> </div> </div> After update: <div class="x-panel x-box-item x-panel-default" id="panel-1078" style="left: 870px; top: 0px; margin: 0px; width: 174px; height: 52px;"> <div id="panel-1078-body" class="x-panel-body x-panel-body-default x-panel-body-default x-box-layout-ct" style="width: 174px; height: 52px; left: 0px; top: 0px;"> February 01 </div> </div> I am available on Sencha chat room.
Your event handler stops working because your update() erases the inner elements added by the panel's layout. You are using either HBox or VBox layout on your panel, which adds additional HTML elements inside the main one, as you noticed. If you call update() on the main component's element, you erase the inner elements added by the layout, including that on which your event handler was listening. The solution is to either: use a simpler layout on your panel, such as Auto; or update the inner element added by the layout: panel.getLayout().targetEl.update('Updated');
If you want to update the content of a panel, you should call panel.body.update('hello'); This will update content area element only and will not ruin the panel integrity. As far as I know, calling update directly on panel is wrong, because call to function inherited from AbstractComponent will not take into account internal panel's structure and will overwrite essential panel's markup.
Responsive design and position: absolute
Is there any suggestion how do you work with position:absolute with responsive design? I have a design which is 1000px width, and left from that container div(1000px) I have image, positioned as position: absolute. Problem is, when I decrease width of browser I get horizontal scroll. What is the proper way with positioning absolute divs with responsive design? Edit: This is an example I am talking about http://jsfiddle.net/FeAUr/ . For purpose of example I set container width to 100px, instead of 1000px. Point is, that I get horizontal scroll bar when I decrease width of my browser because of that "absolute" element with picture. How can I do it in proper way, that I wont get horizontal scroll bar? <div class="bggrey"> <div class="absolute-left"><img src="http://placehold.it/200x200" /></div> <div class="row">content</div> </div> .bggrey{ width: 100%; background: #999; height:500px; } .row{ width:100px; height:500px; background: #fff; margin: auto; } .absolute-left{ position:absolute; left:50%; margin-left:-300px; width:200px; height:100px; }
I accomplished this with making another div for background and putting image as background-image. Using zurb fundation for responsive image helped too.