Snippets Collections
$.fn.showFlex = function() { this.css('display','flex'); }

$(".element").showFlex();
  $(document).ready(function() {

        $('#check').on('submit', function(e) {
            e.preventDefault();

            $('#sub').prop('disable', true)
            $('#sub').text('Checking');
            $.ajax({
                url: '/home/checkorderstatus',
                method: 'POST',
                contentType: false,
                processData: false,
                cache: false,
                data: new FormData(this),
                success: function(data) {
                    $('#success').slideDown('slow').html(data);

                }
            });


            $(document).ajaxComplete(function() {
                $('#sub').prop('disabled', false)
                $('#sub').html('<i class="fa fa-search"></i>')
                $('#check').trigger("reset");
            })

            setTimeout(function() {
                $('#success').hide('slow')
            }, 3000)
        })


    })
 // scroll animations
    // Select all links with hashes
    $('a[href*="#"]')
        // Remove links that don't actually link to anything
        .not('[href="#"]')
        .not('[href="#0"]')
        .click(function(event) {
            // On-page links
            if (
                location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') &&
                location.hostname == this.hostname
            ) {
                // Figure out element to scroll to
                var target = $(this.hash);
                target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
                // Does a scroll target exist?
                if (target.length) {
                    // Only prevent default if animation is actually gonna happen
                    event.preventDefault();
                    $('html, body').animate({
                        scrollTop: target.offset().top
                    }, 1000, function() {
                        // Callback after animation
                        // Must change focus!
                        var $target = $(target);
                        $target.focus();
                        if ($target.is(":focus")) { // Checking if the target was focused
                            return false;
                        } else {
                            $target.attr('tabindex', '-1'); // Adding tabindex for elements not focusable
                            $target.focus(); // Set focus again
                        };
                    });
                }
            }
        });
     let images = document.getElementsByClassName('thumb-image');
     $('#search_templates').keyup(function (e) { 
         let search = $('#search_templates').val().toLowerCase();
         for (let i = 0; i < images.length; i++) {
             let searchVal = images[i].getAttribute('data-search');
             if (searchVal.toLowerCase().indexOf(search) > -1) {
                 images[i].style.display = "";
             }else{
                 images[i].style.display = "none";
             }
             
         }
         
     });
     
     //#search_templates is input and each image has keywords in data-search="" attribute
$(window).bind("pageshow", function() {
    var form = $('form'); 
    // let the browser natively reset defaults
    form[0].reset();
});
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
    google.load("jquery", "1.2.6");
</script>
<script type="text/javascript" src="js/example.js"></script>
$('#elm').hover(
       function(){ $(this).addClass('hover') },
       function(){ $(this).removeClass('hover') }
)
$("a").hover(function() {
       $(this).stop().animate({paddingLeft : "10px"},200);
},function() {
       $(this).stop().animate({paddingLeft : "0px"},200);
});
$("#slideshow > div:gt(0)").hide();

setInterval(function() { 
  $('#slideshow > div:first')
    .fadeOut(1000)
    .next()
    .fadeIn(1000)
    .end()
    .appendTo('#slideshow');
},  3000);
<div id="kitten" style="background-image: url(dog.jpg);">
  <img src="/images/kitten.jpg" alt="Kitten" />
</div>
$("#more-less-options-button").click(function() {
     var txt = $("#extra-options").is(':visible') ? 'more options' : 'less options';
     $("#more-less-options-button").text(txt);
     $("#extra-options").slideToggle();
});
$("#s")
    .val("Search...")
    .css("color", "#ccc")
    .focus(function(){
        $(this).css("color", "black");
        if ($(this).val() == "Search...") {
            $(this).val("");
        }
    })
    .blur(function(){
        $(this).css("color", "#ccc");
        if ($(this).val() == "") {
            $(this).val("Search...");
        }
    });
if ($('#myElement').length > 0) { 
    // it exists 
}
(function($) {
    
  var allPanels = $('.accordion > dd').hide();
    
  $('.accordion > dt > a').click(function() {
    allPanels.slideUp();
    $(this).parent().next().slideDown();
    return false;
  });

})(jQuery);
jQuery.extend({

  getQueryParameters : function(str) {
	  return (str || document.location.search).replace(/(^\?)/,'').split("&").map(function(n){return n = n.split("="),this[n[0]] = n[1],this}.bind({}))[0];
  }

});
if ($(selectionOne) === $(selectionTwo)) {

}
<div id="slideshow">
   <div>
     <img src="//farm6.static.flickr.com/5224/5658667829_2bb7d42a9c_m.jpg">
   </div>
   <div>
     <img src="//farm6.static.flickr.com/5230/5638093881_a791e4f819_m.jpg">
   </div>
   <div>
     Pretty cool eh? This slide is proof the content can be anything.
   </div>
</div>
<div id="kitten" style="background-image: url(dog.jpg);">
  <img src="/images/kitten.jpg" alt="Kitten" />
</div>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js?ver=1.3.2'></script>
<script type='text/javascript' src='/js/jquery.mousewheel.min.js'></script>
<ul>
  <li>one</li>
  <li>two</li>
  <li>three</li>
</ul>
(function() {
    
    var mX, mY, distance,
        $distance = $('#distance span'),
        $element  = $('#element');

    function calculateDistance(elem, mouseX, mouseY) {
        return Math.floor(Math.sqrt(Math.pow(mouseX - (elem.offset().left+(elem.width()/2)), 2) + Math.pow(mouseY - (elem.offset().top+(elem.height()/2)), 2)));
    }

    $(document).mousemove(function(e) {  
        mX = e.pageX;
        mY = e.pageY;
        distance = calculateDistance($element, mX, mY);
        $distance.text(distance);         
    });

})();
(function($) {
    
  var allPanels = $('.accordion > dd').hide();
    
  $('.accordion > dt > a').click(function() {
    allPanels.slideUp();
    $(this).parent().next().slideDown();
    return false;
  });

})(jQuery);
jQuery.extend({

  getQueryParameters : function(str) {
	  return (str || document.location.search).replace(/(^\?)/,'').split("&").map(function(n){return n = n.split("="),this[n[0]] = n[1],this}.bind({}))[0];
  }

});
// Replace source
$('img').on("error", function() {
  $(this).attr('src', '/images/missing.png');
});

// Or, hide them
$("img").on("error", function() {
  $(this).hide();
});
$('iframe').attr('src', $('iframe').attr('src'));
$.ajax({
  type: "POST",
  url: url,
  data: data,
  success: success,
  dataType: dataType
});
bookmark
dashboard

Thu Sep 24 2020 16:45:25 GMT+0000 (UTC)

#jquery
bookmark
dashboard

Thu Aug 27 2020 14:17:42 GMT+0000 (UTC)

#php #codeigniter #jquery
bookmark
dashboard

Fri Aug 14 2020 11:37:34 GMT+0000 (UTC) css-tricks.com

#smoothscroll #jquery
bookmark
dashboard

Thu Jul 02 2020 03:56:02 GMT+0000 (UTC)

#javascript #jquery
bookmark
dashboard

Sun Jun 28 2020 10:47:01 GMT+0000 (UTC) https://stackoverflow.com/questions/8861181/clear-all-fields-in-a-form-upon-going-back-with-browser-back-button

#jquery
bookmark
dashboard

Tue Jun 23 2020 10:05:29 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/loading-jquery/

#jquery
bookmark
dashboard

Tue Jun 23 2020 09:45:54 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/addingremoving-class-on-hover/

#jquery
bookmark
dashboard

Tue Jun 23 2020 09:37:32 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/link-nudging/

#jquery
bookmark
dashboard

Tue Jun 23 2020 09:27:41 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/simple-auto-playing-slideshow/

#javascript #jquery
bookmark
dashboard

Tue Jun 23 2020 09:06:18 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/fade-image-into-another-image/

#jquery
bookmark
dashboard

Mon Jun 22 2020 13:00:11 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/toggle-text/

#jquery
bookmark
dashboard

Wed Jun 03 2020 07:32:34 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/clear-default-search-string-on-focus/

#jquery
bookmark
dashboard

Wed Jun 03 2020 07:31:02 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/check-if-element-exists/

#jquery
bookmark
dashboard

Wed Jun 03 2020 07:30:02 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/simple-jquery-accordion/

#jquery
bookmark
dashboard

Wed Jun 03 2020 07:29:08 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/get-query-params-object/

#jquery
bookmark
dashboard

Wed Jun 03 2020 07:10:06 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/compare-jquery-objects/

#jquery
bookmark
dashboard

Wed Jun 03 2020 07:08:41 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/simple-auto-playing-slideshow/

#jquery
bookmark
dashboard

Wed Jun 03 2020 06:00:01 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/fade-image-into-another-image/

#jquery
bookmark
dashboard

Wed Jun 03 2020 05:54:07 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/horz-scroll-with-mouse-wheel/

#jquery
bookmark
dashboard

Fri May 29 2020 12:29:09 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/move-clicked-list-items-to-top-of-list/

#jquery
bookmark
dashboard

Fri May 29 2020 12:03:09 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/calculate-distance-between-mouse-and-element/

#jquery
bookmark
dashboard

Fri May 29 2020 12:00:09 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/simple-jquery-accordion/

#jquery
bookmark
dashboard

Fri May 29 2020 11:45:11 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/get-query-params-object/

#jquery
bookmark
dashboard

Fri May 29 2020 11:40:32 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/better-broken-image-handling/

#jquery
bookmark
dashboard

Tue May 26 2020 11:29:32 GMT+0000 (UTC) https://css-tricks.com/snippets/jquery/force-iframe-to-reload/

#jquery
bookmark
dashboard

Sat May 09 2020 19:43:38 GMT+0000 (UTC) https://api.jquery.com/jquery.post/

#javascript #jquery
bookmark
dashboard

Sun May 03 2020 23:24:35 GMT+0000 (UTC) https://makitweb.com/how-to-use-switchclass-and-toggleclass-in-jquery/

#javascript #jquery

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension