Enhancing Image Centering with Bootstrap 3 and Isotope jQuery

I've been looking everywhere for a solution to my specific problem, but I can't seem to find one. Can someone help me with this?

My goal is to modify the code so that it displays 2 centered images per row.

<!doctype html>

<html>

<head>

    <title>James Woods</title>

    <!-- Sets Viewport for Responsive Design -->
    <meta name = "viewport" content="width=device-width, initial-scale=1.0">

    <!-- Core Bootstrap CSS -->
    <link href = "../css/bootstrap-custom.css" rel ="stylesheet">

    <!-- Custom Site CSS -->
    <link href = "../css/style.css" rel ="stylesheet">

    <!-- Custom Creations CSS -->
    <link href = "create-style.css" rel ="stylesheet">

</head>

<div class="container">

        <div class = "panel panel-info">

            <div class = "panel-heading">
                <h3 style = "text-align: center;">Creations</h3>

                <div class="creations-filter">

                    <a href="#all" data-filter="*" class="current">All Creations</a>
                    <a href="#scratch" data-filter=".scratch">Scratch Games</a>
                    <a href="#games" data-filter=".games">HTML5/Javacript Games</a>
                    <a href="#apps" data-filter=".apps">Web Applications</a>
                    <a href="#other" data-filter=".other">Other</a>

                </div>
            </div>

            <div class = "panel-body center">

             <div class="creations-container">

                <div class="scratch">
                    <img src="../img/440x250.jpg" alt="image">
                </div> 

                <div class="games">
                    <img src="../img/440x250.jpg" alt="image">
                </div> 

                <div class="other">
                    <img src="../img/440x250.jpg" alt="image">
                </div> 

                <div class="games">
                    <img src="../img/440x250.jpg" alt="image">
                </div> 

                <div class="games">
                    <img src="../img/440x250.jpg" alt="image">
                </div> 

                <div class="apps">
                    <img src="../img/440x250.jpg" alt="image">
                </div> 

            </div>

        </div>



    </div> <!-- END container div -->

I have included jQuery at the end of the page

<!-- Isotope JQuery Plugin -->
    <script src="../js/isotope.js" type="text/javascript"></script> 
    <script src = "../js/bootstrap.js"></script>
    <script type="text/javascript">

    $(window).load(function(){
    var $container = $('.creations-container');
    $container.isotope({
        filter: '*',
        animationOptions: {
            duration: 750,
            easing: 'linear',
            queue: false
        }
    });

    $('.creations-filter a').click(function(){
        $('.creations-filter .current').removeClass('current');
        $(this).addClass('current');

        var selector = $(this).attr('data-filter');
        $container.isotope({
            filter: selector,
            animationOptions: {
                duration: 750,
                easing: 'linear',
                queue: false
            }
         });
         return false;
        }); 
    });

</script>

And here is my custom CSS

.creations-filter a { 
margin-right: 10px; 
color:#666;
text-decoration:none;
}

.creations-filter a.current { 
    font-weight:bold;
}

.creations-filter {
    text-align: center;
}

.creations-container {

}
img {
    margin:5px;
}

.isotope-item {
    z-index: 2;
}
.isotope-hidden.isotope-item {
    pointer-events: none;
    z-index: 1;
}
.isotope,
.isotope .isotope-item {
  /* change duration value to whatever you like */

    -webkit-transition-duration: 0.8s;
    -moz-transition-duration: 0.8s;
    transition-duration: 0.8s;
}
.isotope {
    -webkit-transition-property: height, width;
    -moz-transition-property: height, width;
    transition-property: height, width;
}
.isotope .isotope-item {
    -webkit-transition-property: -webkit-transform, opacity;
    -moz-transition-property: -moz-transform, opacity;
    transition-property: transform, opacity;
}

Your assistance is greatly appreciated :)

P.S Here is the JSFiddle link: http://jsfiddle.net/GwBa8/123/ The images are supposed to be 450x260...

Answer №1

I made some adjustments that you might find helpful. Let me know if you also want the single image to be centered.

.panel-body {
    width: 920px;
    margin:auto;
}

Link to the updated code on JSFiddle

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Utilizing jQuery to Maintain State Across Page Refreshes with Cookies

Currently, I am attempting to create a script that can retain its state even after the page is refreshed. Here is my progress so far: Utilizing jQuery: $(window).ready(function() { var voteId = $('.gallery-item a'); $(voteId).click(function() ...

When a button is clicked, the event is not triggered within a FirefoxOS application

Despite functioning perfectly on Firefox for desktop, my application encounters issues when tested on my ZTE Open C (Firefox OS 1.3). Pressing the button does not trigger any action, while onmouseup and onclick events work flawlessly. Even attempts to bin ...

Images in gallery slider are excessively large

Hello, this is my very first post on stackoverflow. Please forgive any atypical elements in this post. I have a Django Website with a gallery slider, but I am facing an issue where the images appear way too big. You can view them here: I have dedicated n ...

Incorporate the function's output into an <img> tag within an

I am trying to utilize the output of a JavaScript function to populate the 'src' attribute of IMG tags. I plan to implement this in multiple locations on the same page, otherwise I could have used an ID in the IMG tag and update src with getEleme ...

Change the CSS of a table row when a link is in focus

Is there a way to style a <tr> element when an <a> tag inside of it is focused? Below is the HTML for the table: <table> <tr> <td> <a href"#" tabindex="1" accesskey="e">edit</a> &l ...

Adding and subtracting quantities inside a loop

My current issue involves a +/- quantity feature that is functioning correctly, but when integrated into a loop, the quantity amounts duplicate for each input field when the +/- buttons are clicked - please refer to the attached screenshot below. Screensh ...

Is it possible to create a form inside a tooltip?

Looking to incorporate a jQuery feature into a form where a simple yes or no question appears upon hovering over it. However, encountering issues getting jQuery to recognize the dynamically created tooltip and submit alert function not working ("$('#w ...

Determining the element type that was clicked using Angular

Is there a way in Angular to determine the type of element that was clicked? I have successfully implemented this functionality using jQuery, but I'm unsure how to achieve the same outcome in an Angular project. // Click action $(".contactlist").on(" ...

Change a Character or Word in JavaScript after it's been typed

If I were to type the word "hello" into a textarea, is there a way for me to select that specific word and modify it afterwards? For instance, let's say I typed hello without hitting the space bar; could the system recognize this word and automaticall ...

Ensuring the model accurately reflects the input's value attribute in AngularJS

I am in the process of creating a set of image "radio buttons" where only one can be selected per group. However, as a newcomer to Angular, I'm facing difficulties in maintaining the value and using it as my ng-model. Additionally, I am looking for a ...

Configuration of flexbox for cordova on a Samsung Galaxy Tab running on Android version 4.1.2

I am having trouble using flexbox css to design a cordova app on a Galaxy Tab running Android 4.1.2 Here is the CSS code I am currently using: .container { /*display: flex; display: -webkit-box;*/ display: -webkit-flex; /*justify-content: ...

Is it conceivable that Rails may be rendering HTML at a slower rate compared to static

When using a Rails layout, you can include HTML tags to render images like this: <%= image_tag("logo.png", :alt => "Sample App", :class => "round") %> This will generate the following HTML code: <img alt="Sample App" class="round" src="/i ...

Step-by-step guide on retrieving the button text by utilizing a method call

Currently, I am troubleshooting a demo and I'm puzzled as to why the text of the #add-point button is not displaying. $("#add-point").on("click", function(){ activatePointTool(); }); function activatePointTool() { var tool = $(this).text().toU ...

Flipping a 2-dimensional box using CSS and incorporating cascading flex divs

*Please read the note: This question is a bit lengthy as I wanted to explain my thought process. For those who prefer not to read everything, I have created codepens for easy reference. Essentially, I am looking to achieve CSS box flipping effects like t ...

Ways to stop cascading CSS attributes to child elements?

I am in the process of creating three tables. <table id="first"> <tr> <td> 1. CAPTION </td> </tr> <tr> <td> <table id="second"> <tr& ...

Setting input type to date with full width using jQuery Mobile

Currently working on a web project utilizing jQuery Mobile 1.1.1 and looking to incorporate a <input type="date" /> that spans the entire width of the page. However, encountering a peculiar issue (noticing a gap where an arrow should be displayed) sp ...

Dominate with asyncCommand and Ajax in MVC ActionResults

I am currently diving into front-end development and working on a project that involves fixing bugs. Right now, I am utilizing Knockout/MVC ActionResults. One of my tasks is to modify a form so that it cannot be submitted with a double click. I initially ...

Adjustable / consistent box height

For hours, I've been attempting to make some divs the same height. Check out my JSfiddle here: https://jsfiddle.net/4cj5LbLs/15/ I experimented with using display: table; in the parent element and either display: table-cell; or display: table-colum ...

Issue: AngularJS Injector Module Error

Recently started learning angularjs and trying to set up an app. Here's a simple and direct way to do it: Angular controller: (function () { 'use strict'; angular .module('myQuotesApp') .controller(' ...

Can the load API in jQuery be utilized to load fragments using a class selector instead of an id?

I've been working on enhancing a website's dashboard by incorporating more widgets onto the page. Interestingly, these widgets are already present on another page within the same domain. After some research, I discovered that utilizing the load A ...