I’m new to Ghost, I’m using the Dope theme and I’m trying to modify the layout of the main page to show 2 tags on devices with a screen width of 768, and 4 tags on a screen width of 1024. I found this post, and tried editing the code for the file assets/js/main.js
and using the command ghost restart
afterward. However, it doesn’t seem to change the layout for me at all.
Any help would be greatly appreciated. Thanks!
Original code…
function tagFeed() {
'use strict';
var count = $('.tag-feed').attr('data-count');
$('.tag-feed').owlCarousel({
dots: false,
nav: true,
navText: [
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="20" height="20" fill="currentColor"><path d="M26.667 14.667v2.667h-16l7.333 7.333-1.893 1.893-10.56-10.56 10.56-10.56 1.893 1.893-7.333 7.333h16z"></path></svg>',
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="20" height="20" fill="currentColor"><path d="M5.333 14.667v2.667h16l-7.333 7.333 1.893 1.893 10.56-10.56-10.56-10.56-1.893 1.893 7.333 7.333h-16z"></path></svg>',
],
responsive: {
0: {
items: 1,
slideBy: 1
},
1024: {
items: count > 1 ? 2 : count,
slideBy: count
},
1920: {
items: count > 2 ? 3 : count,
slideBy: count
},
2560: {
items: count > 3 ? 4 : count,
slideBy: count
},
}
});
}
My changes…
function tagFeed() {
'use strict';
var count = $('.tag-feed').attr('data-count');
$('.tag-feed').owlCarousel({
dots: false,
nav: true,
navText: [
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="20" height="20" fill="currentColor"><path d="M26.667 14.667v2.667h-16l7.333 7.333-1.893 1.893-10.56-10.56 10.56-10.56 1.893 1.893-7.333 7.333h16z"></path></svg>',
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="20" height="20" fill="currentColor"><path d="M5.333 14.667v2.667h16l-7.333 7.333 1.893 1.893 10.56-10.56-10.56-10.56-1.893 1.893 7.333 7.333h-16z"></path></svg>',
],
responsive: {
0: {
items: 1,
slideBy: 1
},
768: {
items: count > 1 ? 2 : count,
slideBy: count
},
1024: {
items: count > 3 ? 4 : count,
slideBy: count
},
}
});
}