开发者

Javascript - JQuery - OnHover NOT OnClick - Modifying a plugin

If you look at the right, the开发者_JS百科re is a thumbnail gallery. I need to change the action from 'on click' to 'on hover'. I'm not a javascript developer and changing scripts at this point will be futile (too many hours modifying this one...for other reasons).

If you could help me find a way to change the action from 'on click' to 'on hover', I'll be greatly appreciated.

Link is this (edit: removed the link, issue is solved, thanks)

To help you guys out, you'll be looking for the /js/jquery.galleriffic.js file


Well looking at the file there are exactly two onclick handlers, which you will have to change to an onmouseenter handler. I don't see why this might take too many hours. Additionally you can just attach an onmouseenter handler to the appropriate link:

$('a.thumb').mouseenter(function(e)
{
    $(this).click();
});

If you don't want it to be clickable anymore you will have to stop the click event bubbling at the bottom element:

$('a.thumb img').click(function(e)
{
    e.stopImmediatePropagation();
});


I added the two snippets above to the footer of my gallery page, within script tags and it worked!

Thanks

<script type="text/javascript">
            //Makes hover work instead of click on gallery
            $('a.thumb').mouseenter(function(e)
{
    $(this).click();
});

$('a.thumb img').click(function(e)
{
    e.stopImmediatePropagation();
});
        </script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜