jQuery Snippets

    (function ($) {
      $(window).bind("load", function () {
        var first = "http://www.slideshare.net/slideshow/embed_code/21321936?rel=0";
        var hash = location.hash.replace("#","");
        if (hash) {
          first = hash;
        }
        $("iframe").src(first, function(iframe, duration) {
          // Loaded, no extra checks required atm.
        }, {
          timeout: function() {},
          timeoutDuration: 60000
        });
        // Update.
        $(".iframe-link").click(function(event) {
          var url = event.currentTarget.dataset.url;
          var width = event.currentTarget.dataset.width;
          var height = event.currentTarget.dataset.height;
          $("iframe").src(url);
        });
        
      });
    })(jQuery);
jQuery 1.4.4view
$(".selections").append("<div class='letter'>A</div>");
$(".one").click(function () {
    $(".letter").text("B");
});
$(".two").click(function () {
    $(".letter").text("A");
});
,
.selections {
    display:block;
    height:50px;
    width:100%;
}
.radio {
    float:left;
}
.letter {
    display:block;
    margin-left:90px;
    font-size:20px;
    background:#000;
    color:#fff;
    width:20px;
    height:20px;
}
jQuery 1.7.2view
      // Sync flexslider(s).
      var flexslider = $('flexslider selector');
      // Store current flexslider settings.
      if (flexslider) {
        var flexslider2 = $('#flexslider-2').flexslider({
          'slideshow': flexslider.optionsets.default.slideshow,
          'controlNav' : flexslider.optionsets.default.controlNav,
          'directionNav' : flexslider.optionsets.default.directionNav,
          'pauseOnHover' : flexslider.optionsets.default.pauseOnHover,
          'animationSpeed': flexslider.optionsets.default.animationSpeed,
          'slideshowSpeed': flexslider.optionsets.default.slideshowSpeed,
          'initDelay': flexslider.optionsets.default.initDelay,
          'pauseOnAction': false,
          'pauseOnHover': flexslider.optionsets.default.pauseOnHover,
          'keyboard': flexslider.optionsets.default.keyboard,
        });
        // Reset config.
        $('.flexslider').flexslider({
          'slideshow': flexslider.optionsets.default.slideshow,
          'controlNav' : flexslider.optionsets.default.controlNav,
          'directionNav' : flexslider.optionsets.default.directionNav,
          'pauseOnHover' : flexslider.optionsets.default.pauseOnHover,
          'animationSpeed': flexslider.optionsets.default.animationSpeed,
          'slideshowSpeed': flexslider.optionsets.default.slideshowSpeed,
          'initDelay': flexslider.optionsets.default.initDelay,
          'pauseOnAction': false,
          'pauseOnHover': Drupal.settings.flexslider.optionsets.default.pauseOnHover,
          'keyboard': Drupal.settings.flexslider.optionsets.default.keyboard,
          'before' : function(slider) {
            update_flexslider2(slider.animatingTo);
          }
        });

        function update_flexslider2(slide_number) {
          for (i = 0; i < flexslider2.length; i++) {
            $(flexslider2[i]).data('flexslider').flexAnimate(slide_number);
          }   
        }
      }
jQuery 1.4.4view
      // Set scroll direction.
      $(document).scroll(function() {
        sections.waypoint({
          handler: function(event, direction) {
            if (direction == 'down') {
              jQuery.behaviors.direction = '50';
            } else {
              jQuery.behaviors.direction = '-50';
            }
          },
        })
      });
jQuery 1.4.4view
var rotate = {
        'page-251': 200,
        'page-252': 272,
        'page-253': 344,
        'page-254': 416,
        'page-255': 488
      };
      // Rotate logo.
      $.each(rotate, function(page, angle)  {
        if ($(context.activeElement).hasClass(page))  {
          $('.block img').rotate({ animateTo: angle })
        };
      });
jQuery 1.4.4view
      $(".page .row").hover(
        function () {
          $(this).addClass("active");
        },
        function () {
          $(this).removeClass("active");
        }
      );
jQuery 1.4.4view
var mainmenu = $('#main-menu li a'); 
// Waypoint menu.
      sections.waypoint({
        handler: function(event, direction)  {
          // Current page.
          var active_section = $(this);
          if (direction === "") active_section = active_section.prev();
            // @todo, replace with toogle.
            if (current_id) {
              if ($(this).hasClass(current_id)) {
                $(this).addClass('active');
              }
              else {
                $(this).removeClass("active");
              }
            }
        offset: function() {
          return '50';
        }
      })
jQuery 1.5.2view
$(".block").mouseover(function() {

	$(this).animate({ backgroundColor: "black" }, 1000);

	}).mouseout(function() {

    	$(this).animate({ backgroundColor: "#68BFEF" }, 500);

	}) 
	
});
jQuery 1.4.4view
$(function(){
    $('select[value]').each(function(){
        $(this).val(this.getAttribute("value"));
    });
});
,
< select name="category" id="category" value="PHP" >
      <option value="ARTICLE">ARTICLE</option>
      <option value="PHP">PHP</option>  // DEFAULT OPTION
      <option value="MySql">MYSQL</option>
      <option value="jQuery">jQuery</option>
      <option value="CSS(3)">CSS(3)</option>
</ select >
jQuery 1.4.4view
$('input[type=text]').val("");
jQuery 1.4.4view