Optimized dom manipulation for imageslider