Tags » Responsive

Keeping an images ratio on resize in JavaScript

A little tricky task was given to the team I am working in, to keep an image at its aspect ratio. However the catch is that it needs to be able to go as large as it can to fill the screen at all times, while the user can resize the screen and keeping the images size ratio. 772 more words

JavaScript

Right on R!

Be receptive to the good things that are present all around us.

Keep radiating positive light.

You bounce back from difficulties – remarkable.

Relax. 32 more words

Blog Page

WordPress YouTube native responsive

The native YouTube url when you embed into wordpress content is not responsive so we need to add a code to this iframe or embed… 105 more words

Computer Programming

Responsive CSS Grid with brain.js

Just a simple example of how we can use brain.js to change our grid

CodePen Demo@cristianexer



$.fn.gridTemplateColumns = function () {
    return this[0].style.gridTemplateColumns;
}
$.fn.setGridTemplateColumns = function (val) {
     this[0].style.gridTemplateColumns = "repeat("+val+",1fr)";
}

let width = $(window).width(); 
let height = $(window).height();
let post = $('.posts').gridTemplateColumns().split(' ').length;
let trainingData = [];
const net = new brain.NeuralNetwork(); // instance of Neural Netork

$('#size').text('dataFormat(' + height + ', ' + width + ', ' + post+'),');
//add to #size current value of screen in specific format


function scale(value) {
    if (value > 999) return value / 10000;
    else if (value > 99) return value / 100;
    else return value / 1000;
} //scale valuees for better results


function dataFormat(h, w, output) {
    let dataform = {
        input: {
            h: scale(h),
            w: scale(w),
        },
        output: {
        }
    };
    dataform.output = 1;
    return dataform;
}; //return specific format to be easies pushed


trainingData.push(
    //push data to data set
    //height, width, value for repeat
    dataFormat(710, 372, 1),
    dataFormat(710, 530, 2),
    dataFormat(710, 814, 3),
    dataFormat(710, 1106, 4),

);
net.train(trainingData);//train the network

  //activate the network for current window size
let first = brain.likely({
    h: scale(height),
    w: scale(width)
}, net); //activate network for listened window size
$('.posts').setGridTemplateColumns(first);

window.addEventListener('resize', (event) => {
    //listen window resize. 71 more words
Javascript

I loved my time at Riverview and would have stayed on if I could. Extremely clean and dog friendly (not to mention dog park basically onsite) Maintenance was super responsive and immediate.

26 more words
Clean

Resuming, again.

It looked like I would get further, then my device which generally gives trouble as it does with getting power became almost impossible to have powered. 50 more words

Being Honest