I have a file in which I call functions. Some of them do not work. But if the non-working function is moved to another location of this file, it starts working. I understand that the case is most likely in syntax, but I can not find the error. I hope for help. File contents:

$(document).ready(function() { $(".mapopen").click(function() { $(".mapblock").toggle(); $(".viewsr").hide(); }); $(".close").click(function() { $(".mapblock").hide(); }); $("#closform").click(function() { $(".oformlenie").hide(); }); $(".cartt button").click(function() { $(".oformlenie").show(); }); $(".viewopen").click(function() { $(".viewsr").toggle(); $(".mapblock").hide(); }); $(".prim").click(function() { $(".cbox").toggle(); }); $(".viewclose").click(function() { $(".viewsr").hide(); }); $.ionTabs("#tabs_1, #tabs_2, #tabs_3, #tabs_4, #otzivi", { type: "none" }); $(".rslides").responsiveSlides({ auto: true, // Boolean: Animate automatically, true or false speed: 500, // Integer: Speed of the transition, in milliseconds timeout: 4000, // Integer: Time between slide transitions, in milliseconds pager: true, // Boolean: Show pager, true or false nav: false, // Boolean: Show navigation, true or false random: false, // Boolean: Randomize the order of the slides, true or false pause: false, // Boolean: Pause on hover, true or false pauseControls: true, // Boolean: Pause when hovering controls, true or false prevText: "", // String: Text for the "previous" button nextText: "", // String: Text for the "next" button maxwidth: "", // Integer: Max-width of the slideshow, in pixels navContainer: "", // Selector: Where controls should be appended to, default is after the 'ul' manualControls: "", // Selector: Declare custom pager navigation namespace: "rslides", // String: Change the default namespace used before: function() {}, // Function: Before callback after: function() {} // Function: After callback }); $(".rslides2, .rslides3, .rslides4, .rslides5, .rslides6, .rslides7, .c1").responsiveSlides({ auto: true, nav: true, prevText: "", // String: Text for the "previous" button nextText: "" }); $('.crsl-items').carousel({ speed: 1000, autoRotate: 6000, visible: 4, carousel: true }); $(".boxvideo").fitVids(); $('select').styler({ selectSmartPositioning: '-1' }); $('.slide__link').on('click', function(e) { e.preventDefault(); var $this = $(this), item = $this.closest('.slide__item'), wrap = $this.closest('.slideShow'), gap = wrap.find('.slide__gap'), itemPath = $this.find('img').attr('src'), dur = 500; if (!item.hasClass('activSl')) { item.addClass('.activSl').siblings().removeClass('activSl'); gap.find('img').fadeOut(dur, function() { $(this).attr('src', itemPath).fadeIn(dur); }); } }); //Галерея товара }); $(window).load(function() { }) 

With this arrangement

  $(".boxvideo").fitVids(); $('select').styler({ selectSmartPositioning: '-1' }); 

The last function does not work.

Closed due to the fact that off-topic participants Grundy , tutankhamun , aleksandr barakin , Dmitriy Simushev , cheops 15 Sep '16 at 18:13 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Grundy, tutankhamun, aleksandr barakin, Dmitriy Simushev, cheops
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • $ ('select'). styler ({selectSmartPositioning: '-1'}); - Alexander
  • Or $ (". Boxvideo"). FitVids (); depending on the location. - Alexander

1 answer 1

Most likely you subscribe to the parent elements and due to the ascent you process the same event several times. Add some console.log to the handlers and check where something extra is being called.

And still $('select') looks suspiciously the general selector.

  • Select common, yes. But even if I ask it through the class, it does not work. - Alexander