Results 1 to 2 of 2

Thread: Make a Rollover stick

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2009
    Posts
    62

    Make a Rollover stick

    I have a client that wants the rollover state to stick instead of having the user click.

    This needs to stick when rolled over only. Please help!

    Code:
    <script type="text/javascript">
        $(function () {
            var topnum, lastitem;
            var models = $("#middle ul a").each(function () {
                var num = $(this).attr("active_item");
                if (num && !isNaN(num) && (!topnum || (num - 0) > topnum)) {
                    topnum = num - 0;
                    lastitem = this;
                }
            }).mouseover(function () {
                var me = $(this);
                $("#" + me.attr("hover_mn")).show().siblings().hide();
                $("#" + me.attr("hover_mnl")).show().siblings().hide();
                $("#" + me.attr("hover_no")).show().siblings().hide();
                $("#" + me.attr("hover_img")).show().siblings().hide();
            }).mouseout(function () {
                var me = $(this);
                $("#" + def_mn).show().siblings().hide();
                $("#" + def_mnl).show().siblings().hide();
                $("#" + def_no).show().siblings().hide();
                $("#" + def_img).show().siblings().hide();
            }).click(function () { $(this).closest("li").siblings().find("a").andSelf().removeClass("active_rt_item").end().end().end().andSelf().addClass("active_rt_item"); });
    
            var sel = lastitem ? $(lastitem) : models.eq(0);
            var def_img = sel.attr("hover_img");
            var def_mn = sel.attr("hover_mn");
            var def_mnl = sel.attr("hover_mnl");
            var def_no = sel.attr("hover_no");
    
            sel.click().mouseover();
        });
    </script>

  2. #2
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    Re: Make a Rollover stick

    This is the Java forum not the JQuery forum.

    Here is the proper forum: http://www.vbforums.com/forumdisplay.php?f=94

    Now taking a look at your code tell me if I'm wrong but you want the new styles to stay when the user moves their mouse away? Or you want the new styles to only appear when the user puts their mouse over and not click? Just clarify this and I'll give you an answer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width