Tag: show hide

右键单击时,jQuery Hover Menu消失

我有一个菜单在hover时打开。 但是在右键单击时,菜单会在上下文菜单打开时消失。 但我无法弄清楚为什么。 我需要在上下文菜单/右键单击的同时打开hover菜单。 jQuery代码(版本jquery-1.11.2.min.js): jQuery(document).on(‘mouseover’,’#main_menu’,function() { jQuery(‘#main_menu_inner’).show(); }); jQuery(document).on(‘mouseleave’,’#main_menu’,function() { jQuery(‘#main_menu_inner’).hide(); }); HTML: Link Link Link

根据文本长度自动在表格中显示更多/更少的文本

我有一个有两列的表,第二个有时包含大文本,所以我只想显示前100个字符,并显示更多链接以显示剩余的文本。 你可以在这里看到我正在使用的表http://jsfiddle.net/j11mj21x/ 。 为此,我使用此链接中提供的代码( http://viralpatel.net/blogs/dynamically-shortened-text-show-more-link-jquery/ ),我将其放在show_less_more.js文件中: (function($) { $.fn.shorten = function (settings) { var config = { showChars: 100, ellipsesText: “…”, moreText: “more”, lessText: “less” }; if (settings) { $.extend(config, settings); } $(document).off(“click”, ‘.morelink’); $(document).on({click: function () { var $this = $(this); if ($this.hasClass(‘less’)) { $this.removeClass(‘less’); $this.html(config.moreText); } else { $this.addClass(‘less’); $this.html(config.lessText); } $this.parent().prev().toggle(); $this.prev().toggle(); […]

Jquery显示/隐藏密码

Jquery下面工作正常,但我怎样才能缩短这个Jquery? 我必须显示和隐藏密码和确认密码的密码? https://jsfiddle.net/c5cvLo54/1/ $(“.password-showhide .show-password”).click(function() { $(“#password”).attr(“type”, “text”); $(“.password-showhide .show-password”).hide(); $(“.password-showhide .hide-password”).show(); }); $(“.password-showhide .hide-password”).click(function() { $(“#password”).attr(“type”, “password”); $(“.password-showhide .hide-password”).hide(); $(“.password-showhide .show-password”).show(); }); $(“.confirm-password-showhide .show-password”).click(function() { $(“#confirmPassword”).attr(“type”, “text”); $(“.confirm-password-showhide .show-password”).hide(); $(“.confirm-password-showhide .hide-password”).show(); }); $(“.confirm-password-showhide .hide-password”).click(function() { $(“#confirmPassword”).attr(“type”, “password”); $(“.confirm-password-showhide .hide-password”).hide(); $(“.confirm-password-showhide .show-password”).show(); });

显示隐藏内容取决于是否选中了复选框

我对jquery很新,所以我为自己迄今为止所想到的事情感到骄傲。 我要做的是显示/隐藏选项列表,具体取决于适当的复选框状态。 Eveything工作正常,但我无法弄清楚如何检查是否在加载时检查复选框我知道我应该能够使用is.checked现在我有这个javascript $(‘.wpbook_hidden’).css({ ‘display’: ‘none’ }); $(‘:checkbox’).change(function() { var option = ‘wpbook_option_’ + $(this).attr(‘id’); if ($(‘.’ + option).css(‘display’) == ‘none’) { $(‘.’ + option).fadeIn(); } else { $(‘.’ + option).fadeOut(); } }); 根据复选框的状态,它会淡入和淡出一个类。 这是我的HTML click to show text1 This is option one This is another option one click to show text1 This is option […]

用jQuery切换类

当用户点击链接时,我需要隐藏div。 html是这样的: Lorem ipsum Show/hide comments This comments div I want show/hide Lorem ipsum Show/hide comments This comments div I want show/hide ….there’s multiple items after this 默认情况下,注释是隐藏的(因此隐藏了类)。 现在,如果用户单击“显示/隐藏评论”链接,则应显示或隐藏该特定项目的评论,具体取决于它们是否可见。 现在问题是我需要一些id来控制js只挂钩到那个特定的项目ocmments并且我可以用id做吗? js就像atm: $(‘.item .commentsToggle’).click(function(){ elem = $(this).parents(‘.item’); $(elem).find(‘.comments’).each(function() { $(this).toggleClass(‘hidden’); }); }); 如果只有一个项目有效,但多个项目分解:/ 这很简单..我只是不知道如何实际做到这一点:D

如何在jQuery中隐藏表列?

我有一张包含很多列的表格。 我想让用户选择要在表格中显示的列。 这些选项将是复选框以及列名称。 那么如何根据复选框隐藏/取消隐藏表格列? 隐藏(使用.hide())每行中的每个td都有效吗? 也许我可以将复选框值分配给表格中列的位置。 所以第一个复选框意味着第一列,依此类推。 然后递归地隐藏每行中’编号’的td。 那会有用吗?

jQuery hide()div直到完全加载

我正在为我的博客使用标签式精选post。 如何实现div#latest-featured会在内容完全加载后hide()然后show()回来吗? $(document).ready(function() { //Default Action $(“.tab_content”).hide(); //Hide all content $(“ul.tabs li:first”).addClass(“active”).show(); //Activate first tab $(“.tab_content:first”).show(); //Show first tab content //On Click Event $(“ul.tabs li”).click(function() { $(“ul.tabs li”).removeClass(“active”); //Remove any “active” class $(this).addClass(“active”); //Add “active” class to selected tab $(“.tab_content”).hide(); //Hide all tab content var activeTab = $(this).find(“a”).attr(“href”); //Find the rel attribute value to identify […]

用滚动显示/隐藏div

我知道标题不是最具描述性的,并且还有更多类似问题的主题,但我找不到任何答案。 事实上,我得到了这么多,谢谢你们,所以,这就是我要做的。 当页面滚动到某个位置(触发器)时,我想要显示一个DIV,由#othdiv标记。 当您进一步向下滚动到标记为#othdiv2的下一个位置(触发器)时,此DIV会消失。 这感觉就像是一个非常简单的解决方案,但我无法弄明白。 我已经尝试过条件if语句,复制代码,删除行,新变量……叹息……请帮忙。 $(document).ready(function() { $(“#dvid”).hide(); //hide your div initially var topOfOthDiv = $(“#othdiv”).offset().top; var topOfOthDiv2 = $(“#othdiv2”).offset().top; $(window).scroll(function() { if($(window).scrollTop() > topOfOthDiv) { //scrolled past the other div? $(“#dvid”).show(); //reached the desired point — show div } else if($(window).scrollTop() < topOfOthDiv) { //scrolled past the other div? $("#dvid").hide(); //reached the desired […]

当鼠标移动一段时间后,用jQuery隐藏div元素?

我有一个广播video网站,有一个菜单,当鼠标移动一段时间(比方说10秒)时,应该隐藏它。 同样,它应该出现在鼠标移动的状态。 使用css和jQuery执行该操作的最佳方法是什么? 先感谢您。

垂直导航,使用JQuery显示隐藏的子菜单

我正在尝试制作一个与此Flash网站上的菜单类似的菜单: http://elevensix.de/ 当我点击“组合”时,只有子导航链接显示自己。 现在我只设法得到一个典型的垂直“在hover菜单上显示子导航”工作。 所需要的是,一旦它适当的菜单项,它的子菜单显示。 当子菜单项目hover在选中时,此子菜单仍然显示。 选择子菜单项时,显示内容,菜单和子菜单都保持可见(选定的菜单和子菜单项将显示不同的颜色以显示导航路径)。 呼。 这是我的HTML: about testimonials testimonial1 testimonial2 testimonial3 testimonial4 Services services1 services2 services3 services4 Gallery Contact 这是我的css: #nav { width:160px; position: relative; top: 250px; left: 20px; } #nav ul { margin:0px; padding:0px; } #nav ul li { line-height:24px; list-style:none; } #nav a { text-decoration: none; color: #9d9fa2; } #nav […]