Show and hide elements

这一生的挚爱 提交于 2019-12-01 14:55:25

AS per your requirement, please check the link

jsfiddle

There was space in div because of <br/> element. After removing this, you are able to reduce the border as the items hide.

For creating menu, you must use the elements <ul><li> and link inside <li> This will give you alignment as you required.

I think this is you are asking.

Updated code:

$("a:not([name='heada'])").each(function () {

        // If the list item does not contain the text phrase fade it out
        if ($(this).text().search(new RegExp(filter, "i")) < 0) {
            $(this).hide().closest(".slider").hide();

            // Show the list item if the phrase matches and increase the count by 1
        } else {
            $(this).show().closest(".slider").show();
            count++;
        }
});

Example: JFiddle

Add a class to every section header For Eg:

<a href="#" id="show" class="headTag" name="heada"><h3>&nbsp;Section 1</h3></a>

and then the keyup function close, just add :

$(".headTag").show();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!