[Solved] why animate() doesn’t work well with data()?

My guess is that you should be using $(this).data(), not $(‘div’).data(), so that each DIV will keep track of its own animation state. $(‘div’).click(function () { var data = $(this).data(‘animate’); if ( data == 10 ) { $(this).animate({ height: 100 }, 200); $(this).data(“animate”,”100″); } else if ( data == 100 ) { $(this).animate({ height: 10 … Read more

[Solved] Javascript not working with jquery library 1.9.1

FIRST, try this JAVASCRIPT – Part 1 $(document).ready(function () { $(‘a.head’).click(function () { var a = $(this); var section = a.attr(‘href’); section.removeClass(‘section’); $(‘.section’).hide(); section.addClass(‘section’); if (section.is(‘:visible’)) { section.slideToggle(); /* ===== <– 400 is the default duration ===== */ } else { section.slideToggle(); } }); }); JAVASCRIPT – PART 2 $(document).ready(function () { $(‘.rate_widget’).each(function () { … Read more

[Solved] Need help changing from jquery to vanilla javascript

You can achieve this via setTimeout, querySelector and css transition document.querySelector(‘.curtain’).addEventListener(‘click’, function(e) { let f = document.querySelector(‘.fadeout’) setTimeout(function() { f.classList.add(‘fade’) }, 500); setTimeout(function() { f.parentNode.removeChild(f) }, 3500); }); .fadeout { opacity: 1; transition: all 3s; background-color: #f00; color: #fff; padding: 20px; } .fade { opacity: 0 } <div class=”fadeout”>Test fade</div> <button class=”curtain”>click me</button> 12 solved … Read more

[Solved] Looking for a jQuery Slider with 3 Lines [closed]

I’d use slick for this. I wrote up an example on how to use it. $(document).ready(function(){ $(‘.slider’).slick({ infinite: true, arrows:true }); $(“#final”).click(function () { console.log(“Current slides:”); console.log($(‘.slide1’).slick(‘slickCurrentSlide’)); console.log($(‘.slide2’).slick(‘slickCurrentSlide’)); console.log($(‘.slide3’).slick(‘slickCurrentSlide’)); }); }); body { background:black; } .sliderContainer { padding:40px; color:white; } <link rel=”stylesheet” href=”https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css” /> <link rel=”stylesheet” href=”https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css” /> <script type=”text/javascript” src=”https://code.jquery.com/jquery-1.11.0.min.js”></script> <script type=”text/javascript” src=”https://code.jquery.com/jquery-migrate-1.2.1.min.js”></script> <script … Read more