$(document).ready(function(){ if($('.bbb_deals_slider').length) { var bbb_dealsSlider = $('.bbb_deals_slider'); bbb_dealsSlider.owlCarousel( { items:1, loop:false, navClass:['bbb_deals_slider_prev', 'bbb_deals_slider_next'], nav:false, dots:false, smartSpeed:1200, margin:30, autoplay:false, autoplayTimeout:5000 }); if($('.bbb_deals_slider_prev').length) { var prev = $('.bbb_deals_slider_prev'); prev.on('click', function() { bbb_dealsSlider.trigger('prev.owl.carousel'); }); } if($('.bbb_deals_slider_next').length) { var next = $('.bbb_deals_slider_next'); next.on('click', function() { bbb_dealsSlider.trigger('next.owl.carousel'); }); } } if($('.bbb_deals_timer_box').length) { var timers = $('.bbb_deals_timer_box'); timers.each(function() { var timer = $(this); var targetTime; var target_date; // Add a date to data-target-time of the .bbb_deals_timer_box // Format: "Feb 17, 2018" if(timer.data('target-time') !== "") { targetTime = timer.data('target-time'); target_date = new Date(targetTime).getTime(); } else { var date = new Date(); date.setDate(date.getDate() + 2); target_date = date.getTime(); } // variables for time units var days, hours, minutes, seconds; var h = timer.find('.bbb_deals_timer_hr'); var m = timer.find('.bbb_deals_timer_min'); var s = timer.find('.bbb_deals_timer_sec'); setInterval(function () { // find the amount of "seconds" between now and target var current_date = new Date().getTime(); var seconds_left = (target_date - current_date) / 1000; console.log(seconds_left); // do some time calculations days = parseInt(seconds_left / 86400); seconds_left = seconds_left % 86400; hours = parseInt(seconds_left / 3600); hours = hours + days * 24; seconds_left = seconds_left % 3600; minutes = parseInt(seconds_left / 60); seconds = parseInt(seconds_left % 60); if(hours.toString().length < 2) { hours = "0" + hours; } if(minutes.toString().length < 2) { minutes = "0" + minutes; } if(seconds.toString().length < 2) { seconds = "0" + seconds; } // display results h.text(hours); m.text(minutes); s.text(seconds); }, 1000); }); } });
Script Copy url Copy url with Tag
Bootstrap CSS https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css copy copy script
Bootstrap JS https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js copy copy script
Icons https://use.fontawesome.com/releases/v5.7.2/css/all.css copy copy script
Jquery https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js copy copy script

Related Snippets

view all snippets
About this snippet

Bootstrap 4 Deals of the Week ecommerce product Carousel snippet is created by BBBootstrap Team using Bootstrap 4.1.1, Javascript 3.2.1. This snippet is free and open source hence you can use it in your project.Bootstrap 4 Deals of the Week ecommerce product Carousel snippet example is best for Bootstrap carousel, Bootstrap ecommerce, responsive.A great starter for your new awesome project with 1000+ Font Awesome Icons, 4000+ Material Design Icons and Material Design Colors at BBBootstrap.com.

Join BBBootstrap community

Contribute an awesome snippet to help other developer and designers