Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
You need to be checking the browser’s console log for errors when developing with JavaScript.
The error I have with the file is “Uncaught TypeError: Property ‘$’ of object [object Object] is not a function ” so I looked that up and figured out I need to change
$(document).ready(function () {
var cw = $('.block-1').width();
Uncaught TypeError: Property '$' of object [object Object] is not a function
$('#block-me').css({
'height': cw + 'px'
});
});
to
jQuery(document).ready(function () {
var cw = jQuery('.block-1').width();
Uncaught TypeError: Property '$' of object [object Object] is not a function
$('#block-me').css({
'height': cw + 'px'
});
});
Now I have a new problem. The jQuery is making the height 10400 px which is definitely not the width of block-1.
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Can you link the webpage with the issue?
Website caseyvassios(dot)com
Does it have something to do with me using a % width value for block-1 and it not converting to px correctly for block-me height?
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Try removing this jQuery:
jQuery(document).ready(function ($) {
var cw = jQuery('.block-1').width();
$('#block-me').css({
'height': cw + 'px'
});
});
and see if the issue persists.
That’s the whole thing I was wanting to add to make it black block divs squares in the first place :/
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Would it be easier to instead deactivate all plugins?
I’m not sure I understand what you’re saying.
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Can you deactivate all plugins?
If I deactivate my Jetpack plugin it will remove all the CSS I have added for whats on my homepage. I can deactivate contact form 7 and my SEO plugin if you want.
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
In a normal situation your jQuery will work, as you’ve found on JSFiddle. There is something affecting that jQuery and if it’s not plugins then you need to explore whether there could be anything from your theme. So it would be best to contact your theme’s vendors as we don’t support that theme.