Automatically toggle layer when stack created

Is there any way to make it so that when cards are put into a stack, a layer on the cards is automatically toggled to show that they are stacked?