var stCss = document.createElement("link");
stCss.setAttribute("rel", "stylesheet");
stCss.setAttribute("type", "text/css");
stCss.setAttribute("href", "https://myshopifyapps.com/simple-testimonials/flat-ui/css/fonts.css");
document.getElementsByTagName("head")[0].appendChild(stCss);
var stCss = document.createElement("link");
stCss.setAttribute("rel", "stylesheet");
stCss.setAttribute("type", "text/css");
stCss.setAttribute("href", "https://myshopifyapps.com/simple-testimonials/css/st-grid.css");
document.getElementsByTagName("head")[0].appendChild(stCss);
var stWidget = `
`;
var stElem = '';
var stCurrent = 1;
var stLimit = 6;
$(function(){
stElem = $('#simple-testimonial-widget');
if (stElem.length) {
stInit();
}
$('#st-prev').click(function(event){
event.preventDefault();
stPrev();
});
$('#st-next').click(function(event){
event.preventDefault();
stNext();
});
});
function stInit()
{
$(stElem).html(stWidget);
}
function stAnimate(from, to)
{
$('#st-block-'+from).fadeOut(function(){
$('#st-block-'+to).fadeIn();
});
}
function stPrev()
{
if (stCurrent!=1) {
stAnimate(stCurrent, stCurrent-1);
stCurrent--;
} else {
stAnimate(stCurrent, stLimit);
stCurrent = stLimit;
}
}
function stNext()
{
if (stCurrent!=stLimit) {
stAnimate(stCurrent, stCurrent+1);
stCurrent++;
} else {
stAnimate(stCurrent, 1);
stCurrent = 1;
}
}