Return to Snippet

Revision: 19717
at October 29, 2009 10:45 by joe-bbb


Updated Code
function mouse_addClass_linkExpand () {

  $.each(arguments, function() {
    var hover_class = this.hover_class;
    var link_expand = this.link_expand;

		 $(this.hover_selector).each(function(){
			 var selected = $(this);
			 if ( selected.find('a').length == 1) {
				 selected.hover(function() {
					$(this).addClass(hover_class);
				 },
				 function() {
					$(this).removeClass(hover_class);
				 });
			 }

			 if ( link_expand == true && selected.find('a').length == 1) {
				selected.click(function(){
				  var href = $(this).find('a').attr('href');
				  window.location.href = href;
				});
			 }

		 });
  });
}

// to call it do

mouse_addClass_linkExpand ( 
    {hover_selector: '#newsletter .right', hover_class: 'hovered', link_expand: true}
);

Revision: 19716
at October 29, 2009 10:42 by joe-bbb


Updated Code
function mouse_addClass_linkExpand () {

  $.each(arguments, function() {
    var hover_class = this.hover_class;
    var link_expand = this.link_expand;

		 $(this.hover_selector).each(function(){
			 var selected = $(this);
			 if ( selected.find('a').length == 1) {
				 selected.hover(function() {
					$(this).addClass(hover_class);
				 },
				 function() {
					$(this).removeClass(hover_class);
				 });
			 }

			 if ( link_expand == true && selected.find('a').length == 1) {
				selected.click(function(){
				  var href = $(this).find('a').attr('href');
				  window.location.href = href;
				});
			 }

		 });
  });
}

// to call it do

mouse_addClass_linkExpand ( 
                 {hover_selector: '#newsletter .right', hover_class: 'hovered', link_expand: true},

Revision: 19715
at October 29, 2009 10:41 by joe-bbb


Initial Code
function mouse_addClass_linkExpand () {

  $.each(arguments, function() {
    var hover_class = this.hover_class;
    var link_expand = this.link_expand;

		 $(this.hover_selector).each(function(){
			 var selected = $(this);
			 if ( selected.find('a').length == 1) {
				 selected.hover(function() {
					$(this).addClass(hover_class);
				 },
				 function() {
					$(this).removeClass(hover_class);
				 });
			 }

			 if ( link_expand == true && selected.find('a').length == 1) {
				selected.click(function(){
				  var href = $(this).find('a').attr('href');
				  window.location.href = href;
				});
			 }

		 });
  });
}

Initial URL

                                

Initial Description

                                

Initial Title
mouse_addClass_linkExpand

Initial Tags
link

Initial Language
jQuery