12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- $(document).ready(function(){
- //slider
- const slider = $("#slider").owlCarousel({
- nav: true,
- items:2,
- loop:true,
- margin:15,
- responsive:{
- 600:{
- items:5
- },
- }
- });
- //dropdown
- function initializeCheckboxDropdown(containerId) {
- var dropdown = $('#' + containerId + ' .dropdown-menu');
- dropdown.find('.dropdown-item input[type="checkbox"]').on('change', function(){
- var selectedItems = [];
- dropdown.find('.dropdown-item input:checked').each(function(){
- selectedItems.push($(this).val());
- });
- $('#' + containerId + ' .dropdown-toggle').text(selectedItems.length > 0 ? selectedItems.join(', ') : 'Выберите элементы');
- });
- $(document).on('click', function(event){
- if(!dropdown.is(event.target) && dropdown.has(event.target).length === 0){
- dropdown.removeClass('show');
- $(".dropdown-toggle").removeAttr('style');
- }
- });
- $('#' + containerId + ' .dropdown-toggle').on('click', function(){
- dropdown.toggleClass('show');
- $(this).css({
- 'border': "2px solid #146aff",
- 'background': "#fff",
- });
- });
- }
-
- initializeCheckboxDropdown('dropdown1');
- initializeCheckboxDropdown('dropdown2');
-
- //gallery
- $(".gallery").find("img").each((i,e)=>{
- $(e).click(function(){
- $("#gallery_wrapper").attr("src", $(this).attr("src"));
- });
- });
- //sidebar
- $("#switch_sidebar").click(function(){
- $(".sidebar").toggleClass("closed");
- });
-
- });
|