How to change item image along with their slideshow when variants button is clicked in template page

while creating an eCommerce, website when I created Item template and made variants item-image remain the same on any variants button clicked. I want that when i click to variant button it whole item-image including slideshow comes with respect to variants button.