I'm trying to make responsible grid with thumbnails using bootstrap and knockout. Currently i have the next html:
<div class="row">
<!-- ko if: toys().length == 0 -->
<div>No toys in category</div>
<!-- /ko -->
<!-- ko foreach: toys-->
<div class="col-lg-2 col-md-3 col-sm-4 col-xs-6 previewGridItem">
<a class="thumbnail" data-bind="attr: { href: '#!/toy/' + id }">
<img data-bind="attr: {src: images[0] ? images[0] : '/Content/img/NoImage.jpg' }" />
<span data-bind="text: name"></span>
</a>
</div>
<!-- /ko -->
</div>
Sometimes i'm getting correct grid. But in most cases (ofcourse depending on size of images and length of item's names) i've got something like this:
.
How to properly align items? The most simple answer is to set height of images to constant, but then the proportions of images are ruined. More over, i want images resizing including height. Text are limited by 2 lines per image.
Live demo: JSFiddle
I suggest you to take a look at Gridalicious plugin - it's created exactly for this type of situations. It's also pretty fast, and can be easly adjusted for your needs with built in configurable parameters as well as simply editing uncompressed version of plugin accordingly to your needs.
http://suprb.com/apps/gridalicious/
For now, i solved problem using jQuery plugin mentioned in comment by Artanis. I've also have to use plugin imagesLoaded because i have ajax call which loading images. In result i've written next code:
window.imagesLoaded(".previewGridItem", function(instance) {
$(".previewGridItem").matchHeight();
});
I do not think that it's the best solution, because now i have 40kb (12Kb minimized) libraries only to align images. But for now i can't find a solution only with css.
Related
I am trying to create a portfolio by combining two themes.
The first theme and basis for the project is this one. I like the whole moving stars effect so that is why I decided for this one.
The second theme is this one. From this theme I want to take the grid system with the cards and implement it into the first one. .
To do this, I have copied all the files from the second project that I think are relevant into the first one and I kind of got what I want. But, somehow the full effects are not implemented. My project can be accessed from this repository.
To show an example:
One post looks like this. Ideally it should be only one picture which when opened should show the full version of the post. I tried to copy the css variable into the html file in a <style> COPIED HERE </style>.
I am an absolute beginner and my goal is just to get a working webpage. Could someone hint me why I am not getting the expected effects?
Just a guess because your post does not include your HTML and CSS and your page isn't showing the non-working sample site from your screenshot.
The grid with the images uses the Bootstrap grid system as you can see on the col-sm-4 below.
Here's the file that includes bootstrap, _includes/js.html:
<!-- jQuery Version 1.11.0 -->
<script src="{{ " js/jquery-1.11.0.js" }}"></script>
<!-- Bootstrap Core JavaScript -->
<script src="{{ " js/bootstrap.min.js" }}"></script>
...
You may need to inspect the grid part even more:
<div class="row">
<div class="col-sm-4 portfolio-item">
<a href="#portfolioModal-1" class="portfolio-link" data-toggle="modal">
<div class="caption">
<div class="caption-content">
<i class="fa fa-search-plus fa-3x"></i>
</div>
</div>
<img src="img/portfolio/cabin.png" class="img-responsive" alt="image-alt">
</a>
</div>
...
I'd like to have that outline circle around the word "reality" but it also has to be responsive. The end goal is below.
Currently however, I have what is below.
Since I am using Gutenberg, I do not know how to overlay the image on the given word. I have tried relative CSS (setting the image to relative and adding px to try and fit it). Not only did that not work, it would not be responsive anyways. Is there any custom CSS for me to achieve this?
The following are my blocks turned into CSS:
<div class="wp-block-kadence-column inner-column-1 kadence-column_84ec52-24"><div class="kt-inside-inner-col"><!-- wp:kadence/advancedheading {"level":1,"uniqueID":"_4a3254-47","color":"#333333","size":60,"lineHeight":70,"mobileSize":50,"mobileLineHeight":60,"typography":"Lora","googleFont":true,"fontSubset":"latin","fontVariant":"700italic","fontWeight":"700","topMargin":0,"bottomMargin":10,"markSize":["","",""],"markLineHeight":["","",""],"markPadding":[0,0,0,0],"colorClass":""} -->
<h1 class="kt-adv-heading_4a3254-47 wp-block-kadence-advancedheading" data-kb-block="kb-adv-heading_4a3254-47">We write your<br>ideas into <em>reality</em>.</h1>
<!-- /wp:kadence/advancedheading -->
<!-- wp:kadence/image {"id":1976,"sizeSlug":"full","linkDestination":"none","uniqueID":"_e2485d-a0"} -->
<figure class="wp-block-kadence-image kb-image_e2485d-a0 size-full"><img src="http://emandapen.local/wp-content/uploads/2022/09/Vector.png" alt="" class="kb-img wp-image-1976"/></figure>
<!-- /wp:kadence/image -->
</div></div>
Thanks in advance.
I want to display two items of carousel side by side in the frontend in TYPO3, but I can display just one item now.
I have no idea how I can write some codes with Fluid in a HTML-file to display two items.
I use a plug-In bootstrap_package and bild a carousel like a carousel of bootstrap_packgae now. But the carousel of bootstrap_package has just a item on a slide.
However, I want to display two items on a page and if a user click a button (preview or next), another item will be displayed. My image is like this:
Now my codes in a HTM-file CarouselStartseiteAngebote.html (in Template) seem like so:
<f:if condition="{records}">
<div id="carousel-{data.uid}" class="carousel carousel-small carousel-startseite-angebote carousel-{data.pi_flexform.transition} slide" {f:if(condition: data.pi_flexform.interval, then: 'data-interval="{data.pi_flexform.interval}" ')}data-wrap="{f:if(condition:data.pi_flexform.wrap,then:'true',else:'false')}" data-ride="carousel" {f:if(condition: data.pi_flexform.interval, then: 'data-bs-interval="{data.pi_flexform.interval}"')} data-bs-wrap="{f:if(condition:data.pi_flexform.wrap,then:'true',else:'false')}" data-bs-ride="carousel">
<div class="carousel-inner carousel-startseite-angebote-inner">
<f:for each="{records}" as="item" iteration="iteration">
<f:variable name="itemClass">item</f:variable>
<f:if condition="{iteration.isFirst}">
<f:variable name="itemClass">{itemClass} active</f:variable>
</f:if>
<f:variable name="itemClass">{itemClass} carousel-item</f:variable>
<f:variable name="itemClass">{itemClass} carousel-item-layout-{f:if(condition: item.data.layout,then:item.data.layout,else: 'custom')}</f:variable>
<f:variable name="itemClass">{itemClass} carousel-item-type-{item.data.item_type}</f:variable>
<div class="{itemClass}" data-itemno="{iteration.index}">
<f:render partial="Carousel/General/BackgroundImage" arguments="{_all}" />
<div class="carousel-content carousel-startseite-angebote-content">
<f:render partial="Carousel/Item/{item.data.item_type -> bk2k:format.upperCamelCase()}" arguments="{_all}" />
</div>
</div>
</f:for>
</div>
<f:render partial="Carousel/Control/ControlStartseiteAngebote" arguments="{_all}" />
</div>
</f:if>
In a CarouselStartseiteAngebote.html (in Partial):
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:if condition="{records -> f:count()} > 1">
<button data-slide="prev" data-target="#carousel-{data.uid}" data-bs-slide="prev" data-bs-target="#carousel-{data.uid}" type="button" class="carousel-control carousel-control-prev carousel-startseite-angebote-control-prev">
<span class="startseite-angebote-icons-prev carousel-startseite-angebote-icons slidenow"></span>
<span class="visually-hidden">{f:translate(key: 'previous', extensionName: 'rasanidesign_startseite-angebote')}</span>
</button>
<button data-slide="next" data-target="#carousel-{data.uid}" data-bs-slide="next" data-bs-target="#carousel-{data.uid}" type="button" class="carousel-control carousel-control-next carousel-startseite-angebote-control-next">
<span class="startseite-angebote-icons-next carousel-startseite-angebote-icons"></span>
<span class="visually-hidden">{f:translate(key: 'next', extensionName: 'rasanidesign_startseite-angebote')}</span>
</button>
</f:if>
</html>
In a TextAndImageForCarouselStartseiteAngebote.html (in Partial):
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:link.typolink parameter="{item.data.link}" additionalAttributes="{draggable:'false'}">
<div class="carousel-sa-content">
<!-- Slider1 -->
<div class="carousel-startseite-angebote-content-inner-container row saslider">
<!-- Imagefeld -->
<div class="carousel-startseite-angebote-left col">
<f:if condition="{item.images.0}">
<f:variable name="image-startseite-angeboteConfig">{settings.responsiveimages.contentelements.{data.CType}}</f:variable>
<f:variable name="image-startseite-angeboteConfig">{image-startseite-angeboteConfig.{item.data.item_type}}</f:variable>
<bk2k:data.imageVariants as="variants" variants="{variants}" multiplier="{image-startseite-angeboteConfig.multiplier}" gutters="{image-startseite-angeboteConfig.gutters}" corrections="{image-startseite-angeboteConfig.corrections}" />
<f:render partial="Media/Rendering/ImageStartseiteAngebote" arguments="{file: item.images.0, data: item.data, settings: settings, variants: variants}" />
</f:if>
</div>
<!-- Textfeld -->
<div class="carousel-startseite-angebote-right col">
<div class="carousel-startseite-angebote-right-container">
<h{item.data.header_layout} class="carousel-startseite-angebote-header-h4 carousel-header{f:if(condition: item.data.header_class, then: ' {item.data.header_class}')}{f:if(condition: item.data.header_position, then: ' text-{item.data.header_position}')}"><f:format.htmlspecialchars doubleEncode="false">{item.data.header}</f:format.htmlspecialchars></h{item.data.header_layout}>
<f:if condition="{item.data.subheader}">
<h{item.data.subheader_layout} class="carousel-startseite-angebote-header-h2 carousel-startseite-angebote-image carousel-subheader{f:if(condition: item.data.subheader_class, then: ' {item.data.subheader_class}')}{f:if(condition: item.data.header_position, then: ' text-{item.data.header_position}')}"><f:format.htmlspecialchars doubleEncode="false">{item.data.subheader}</f:format.htmlspecialchars></h{item.data.subheader_layout}>
</f:if>
<span class="carousel-startseite-angebote-bodytext"><f:format.html>{item.data.bodytext}</f:format.html></span>
</div>
</div>
</div>
</div>
</f:link.typolink>
</html>
What schould I wirte codes to display two items side by side? The items have to switch step by step and they have to be repeated.
I tryed to give a condition on the line 6 in the CarouselStartseiteAngebote.html:
<f:if condition="{iteration.isFirst} && {iteration.index}">
If I check it using developer-tool, then I could find two items. But I can't display anything in the frontend, even first item, because the word "active" is disappeared.:
How can I add the word "active" for the two items? ALso, if another item comes up, how can I remove the word "active" from the previous item?
I hope someone can give me an advice or correct codes. Thank you.
That't actually more a styling thing. Take a slider plugin that fit your needs e.g. https://swiperjs.com/demos#slides-per-view
and build the template (html, css, js) according to your needs.
In general:
Special interactive elements in a web page are build normally by javascript that takes some standard HTML like lists and transforms it to a carousel, an accordion, a slider or similar.
This javascript needs a container which is identified by a class or an id so that the controls only effect the contained elements of this element.
In this way you can have two carousels (or similar) in a page which are independent of each other.
In TYPO3 you have full control over the rendering and can generate everything you like by adding your own fluid templates. for the unique identifier you can use the uid field of the content element or any relevant record.
You can display anything as far as you have the javascript library to modify the original HTML and to change the HTML for your wished behaviour.
Look in the web to get a javascript library which handles your behaviour, include it in the page, build the required HTML markup and don't forget to add the initialization call for each element (that could either behind the HTML) or with an asset viewhelper in the usual position at the end of the page.
I've been trying to work out the widget feature, however I'm unable to get this working as expected. This is my header as of now:
<div class="col-xs-6 col-md-6">
<div class="widget-header">
<span class="widget-caption header-title"> User Groups </span>
</div>
</div>
It's actually been irritating since I'm unsure what I've been doing wrong, all I want is the default widget shown here:
http://beyondadmin-v1.6.0.s3-website-us-east-1.amazonaws.com/widgets.html
Please make sure that you've referred the stylesheets of Beyond template.
<!-- Beyond styles -->
<link href="assets/css/beyond.min.css" rel="stylesheet" />
The location of href may vary according to your folder structure.
Ref URL: http://apps-empresariales.com/conta/dev/docs/
I'm typically more of a backend guy, but I find myself working on a project that requires some frontend work. I'm fumbling my way through using bootstrap, and I find myself stuck on the following:
<div id="form" class="col-md-6">
<!-- form goes here -->
</div>
<br /> <!-- multiple br tags do nothing, as long as col-md-6 is used above -->
<div id="image_container">
<image src="myimage.jpg" />
</div>
I want a gap between the end of the form and the top of the image, but col-md-6 seems to be resulting in there being overlap, and the image-div is vertically larger than it is on the same page with col-md-6 removed.
Admittedly, CSS has never been my forté, but I'm hoping to address that soon. In the meantime, can someone help me out with this issue?
Seems you're not using the grid system correctly, you have to use rows and cols to separate your elements in your frontend.
Check this link about Bootstrap Grid System