[code] Nút ẩn hiện chuyên mục hiệu ứng trượt lên xuống

    [code] Nút ẩn hiện chuyên mục hiệu ứng trượt lên xuống

    Bài gửi  by AnhDauSai Tue Sep 02, 2014 2:53 pm

    demo onl: http://hotro71.forumvi.com/
    Demo ảnh:

    cho đoạn code sau vào cuối overall_footer_end
    Code:
      <script type="text/javascript">var partname = location.pathname.slice(1, 5);$("div.page-title h2").prepend('<span class="collapse" style="float:right"><a href="javascript:void(0);" alt="fmClose"><img src="http://i46.servimg.com/u/f46/17/46/31/07/collap10.png"></a><a href="javascript:void(0);" style="display:none" alt="fmOpen"><img src="http://i46.servimg.com/u/f46/17/46/31/07/collap11.png"></a></span>');$(".collapse").each(function (index) {$(this).attr("id", "fmvicollapse" + partname + index);if (my_getcookie("fmvicollapse" + partname + index) == "1") {$(this).children("a[alt='fmClose']").hide();$(this).children("a[alt='fmOpen']").show();$(this).parent().parent().parent().next().hide()}});$(".collapse a[alt='fmClose']").click(function () {my_setcookie($(this).parent().attr("id"), 1, 1, 0);$(this).hide().next().show();$(this).parent().parent().parent().parent().next().slideUp()});$(".collapse a[alt='fmOpen']").click(function () {my_setcookie($(this).parent().attr("id"), 0, 1, 0);$(this).hide().prev().show();$(this).parent().parent().parent().parent().next().slideDown()});if (partname != 'priv') {$("form.frm-form .main .clearfix, .fmviToggle .main .clearfix").prepend('<span class="collapsePost" style="float:right"><a href="javascript:void(0);" alt="fmClose"><img src="http://i46.servimg.com/u/f46/17/46/31/07/collap11.png"></a><a href="javascript:void(0);" style="display:none" alt="fmOpen"><img src="http://i46.servimg.com/u/f46/17/46/31/07/collap11.png"></a></span>');$(".collapsePost").each(function (index) {$(this).attr("id", "fmvicollapsePost" + partname + index);if (my_getcookie("fmvicollapsePost" + partname + index) == "1") {$(this).children("a[alt='fmClose']").hide();$(this).children("a[alt='fmOpen']").show();$(this).parent().next().hide()}});$(".collapsePost a[alt='fmClose']").click(function () {my_setcookie($(this).parent().attr("id"), 1, 1, 0);$(this).hide().next().show();$(this).parent().parent().next().slideToggle("slow")});$(".collapsePost a[alt='fmOpen']").click(function () {my_setcookie($(this).parent().attr("id"), 0, 1, 0);$(this).hide().prev().show();$(this).parent().parent().next().slideToggle("slow")})}</script>

    nguồn: hotrofm.com
    AnhDauSai