zoukankan      html  css  js  c++  java
  • jquery-plugin-biggerLink,highLight-层加亮_andy 阳光生活_百度空间

    How to get the xpath by clicking an html element

    How to get the xpath by clicking an html element

    Quick Tip: Outline Elements on Hover

    Quick Tip: Outline Elements on Hover

    Highlight On Mouseover Effect With JQuery

    Highlight On Mouseover Effect With JQuery I have seen this effect been used a lot on e-commerce sites or sites with lists in general. I don’t know how they do it exactly but I can show you how I would do it with JQuery. Take a look at the CSS class I made, what it does is it has a gold background color and round corners for Firefox, Safari and Chrome. .highlight-yellow { background-color:#FFD700; -moz-border-radius: 5px; -webkit-border-radius: 5px; } Let’s make the divisions we will highlighting.
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ac lectus sem, at placerat tortor. Duis a justo non arcu interdum posuere. Suspendisse id lacinia felis. Cras pharetra, enim eu vestibulum imperdiet, dui ligula pretium est, eu blandit risus turpis gravida augue
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ac lectus sem, at placerat tortor. Duis a justo non arcu interdum posuere. Suspendisse id lacinia felis. Cras pharetra, enim eu vestibulum imperdiet, dui ligula pretium est, eu blandit risus turpis gravida augue
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ac lectus sem, at placerat tortor. Duis a justo non arcu interdum posuere. Suspendisse id lacinia felis. Cras pharetra, enim eu vestibulum imperdiet, dui ligula pretium est, eu blandit risus turpis gravida augue
    All I need now is to make a script that adds the CSS class we just made to the divisions when the mouse is on it, when the mouse moves out of the division I will remove the class. $(document).ready(function(){ $(".product").mouseover(function(){ $(this).addClass("highlight-yellow"); }); $(".product").mouseout(function(){ $(this).removeClass("highlight-yellow"); }); }); I don’t think I’ve told you about $(this) in any of my previous tutorials, in short, all $(this) does is refer to the current element on which the event (mouseout or mouseover) is been performed. As always, happy JQuerying!

    jquery-plugin-biggerLink,highLight-层加亮_andy 阳光生活_百度空间

    jquery-plugin-biggerLink,highLight-层加亮 yeah邮箱->jquery->jquery-biggerLink-层加亮 由jquery.biggerlink.js源码修改,剔除多个链接只能第一个链接和点击层起作用的功能,纯粹的加亮作用。 jquery.highLight.js 用法:        $('#links3 div').highLight(); js:         (function($) {             $.fn.highLight = function(options) {                 // Default settings                 var settings = {                     hoverclass:'hover', // class added to parent element on hover                     clickableclass:'hot', // class added to parent element with behaviour                            };                 if(options) {                     $.extend(settings, options);                 }                 $(this).addClass(settings.clickableclass).each(function(i){                        $(this)                     .mouseover(function(){                         $(this).addClass(settings.hoverclass);                     })                     .mouseout(function(){                         $(this).removeClass(settings.hoverclass);                     })                            });                 return this;             };         })(jQuery); 解决IE问题:                 (function($) {                     $.fn.highLight = function(options) {                         // Default settings                         var settings = {                             hoverclass:'hover', // class added to parent element on hover                             clickableclass:'hot', // class added to parent element with behaviour                             follow: true    // follow link? Set to false for js popups                         };                         if(options) {                             $.extend(settings, options);                         }                         $(this).filter(function(){                              return $('a',this).length > 0;                         }).addClass(settings.clickableclass).each(function(i){                             // Add title of first link with title to parent                             $(this).attr('title', $('a[title]:first',this).attr('title'));                             // hover and trigger contained anchor event on click                             $(this)                             .mouseover(function(){                                 window.status = $('a:first',this).attr('href');                                 $(this).addClass(settings.hoverclass);                             })                             .mouseout(function(){                                 window.status = '';                                 $(this).removeClass(settings.hoverclass);                             })                             // triggerable events on anchor itself                             .find('a').bind('focus',function(){                                 $(this).parents('.'+ settings.clickableclass).addClass(settings.hoverclass);                             }).bind('blur',function(){                                 $(this).parents('.'+ settings.clickableclass).removeClass(settings.hoverclass);                             }).end()                         });                         return this;                     };                 })(jQuery); css:         /* Put a border around the newly clickable element */         .hot {             border: solid 1px #ccc;             zoom: 1; /* Should be IE only */         }         /* rollover style for clickable element */         .hover {             border-color: #aaf;             cursor: pointer;             background-color: #cdF;         }         /* Simulate hover on contained link */         .hover a:link {             color: #CC3333;         }         .hover a:visited {             color: #CC3333;         } 附jquery.biggerlink.js         (function($) {             $.fn.biggerlink = function(options) {                 // Default settings                 var settings = {                     hoverclass:'hover', // class added to parent element on hover                     clickableclass:'hot', // class added to parent element with behaviour                     follow: true    // follow link? Set to false for js popups                 };                 if(options) {                     $.extend(settings, options);                 }                 $(this).filter(function(){                     return $('a',this).length > 0;                 }).addClass(settings.clickableclass).each(function(i){                                     // Add title of first link with title to parent                     $(this).attr('title', $('a[title]:first',this).attr('title'));                                         // hover and trigger contained anchor event on click                     $(this)                     .mouseover(function(){                         window.status = $('a:first',this).attr('href');                         $(this).addClass(settings.hoverclass);                     })                     .mouseout(function(){                         window.status = '';                         $(this).removeClass(settings.hoverclass);                     })                     .bind('click',function(){                         $(this).find('a:first').trigger('click');                     })                                         // triggerable events on anchor itself                                         .find('a').bind('focus',function(){                         $(this).parents('.'+ settings.clickableclass).addClass(settings.hoverclass);                     }).bind('blur',function(){                         $(this).parents('.'+ settings.clickableclass).removeClass(settings.hoverclass);                     }).end()                                         .find('a:first').bind('click',function(e){                         if(settings.follow == true)                         {                             window.location = this.href;                         }                         e.stopPropagation(); // stop event bubbling to parent                     }).end()                                         .find('a',this).not(':first').bind('click',function(){                         $(this).parents('.'+ settings.clickableclass).find('a:first').trigger('click');                         return false;                     });                 });                 return this;             };         })(jQuery);
  • 相关阅读:
    vim编辑器介绍
    Linux基本命令
    Linux之文档与目录结构
    远程连接Linux
    VMware与Centos系统安装之重置root密码
    关于学习观
    mysql行转列,函数GROUP_CONCAT(expr)
    <a>超链接标签,<button>按钮标签,实现返回跳转
    2019年10月20日第一次参加自学考试
    disabled属性对form表单提交的影响
  • 原文地址:https://www.cnblogs.com/lexus/p/3598837.html
Copyright © 2011-2022 走看看