Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahuldstiwari/337b9ec8e0e52996de8b64d931797c4c to your computer and use it in GitHub Desktop.
Save rahuldstiwari/337b9ec8e0e52996de8b64d931797c4c to your computer and use it in GitHub Desktop.
This is project specific code, just for record.
<script type="text/javascript">
function Imagw(thisvalue) {
var slideshow = $('#slider-product-template-2');
theme.slideshows[slideshow] = new theme.Slideshow(slideshow);
// slideshow.flexslider(6);
var $newImgs = slideshow.find(
'.slide[data-img-alt="' + thisvalue + '"]'
);
slideshow.find('.slide').removeClass('rt');
$newImgs.addClass('rt');
var index = slideshow.find('.rt:eq(1)').attr('data-index');
slideshow.flexslider(parseInt(index));
var index_array = []
slideshow.find('.slide').not('.rt').each(function() {
index_array.push($(this).attr('data-index'));
});
$('.flex-control-thumbs > li').removeClass('rt1');
$.each(index_array, function(index, value) {
$('.flex-control-thumbs').find('li:eq(' + parseInt(value) + ')').addClass('rt1');
});
theme.slideshows[slideshow] = new theme.Slideshow(slideshow);
$('.flex-control-thumbs > li').show();
$('.flex-control-thumbs').find('li:eq(0)').hide();
$('.rt1').hide();
}
$(function() {
$(document).on('change', 'select', function() {
var thisvalue = $(this).find("option:selected").text();
if(thisvalue == "Vanilla" || thisvalue == "Chocolate"){
Imagw(thisvalue)
}
});
$(".tab button").click(function(){
var radioValue = $(this).find("input[name='sele']:checked").val();
if(radioValue == "one-time-purchase"){
// alert("one-time-purchase");
var text = $('.'+radioValue).find(".jumpstart-selector select option:selected").text();
Imagw(text);
}
else if(radioValue == "monthly-subscription"){
// alert("monthly-subscription");
var text = $('.'+radioValue).find(".jumpstart-selector select.single-option-selector option:selected").text();
Imagw(text);
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment