Hi i've been searching and trying things to achieve this and haven't found anything to make it work.
The thing is I am using gallerific.js so what I wanted is to hover the images without having to click with the links, I achieved that, then I wanted to make links linkable and it works, my only problem is that as I am using mousenter in the same class that I use window.open, site tries to open me popups with the link to open.window. Here is my code:
<li>
<a class="thumb" href="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>"><?php echo $product['name']; ?></a>
<script type="text/javascript">
$("a.thumb").click(function(){
window.open("index.php?route=product/product&product_id=<? echo $rest;?>")
});
</script>
</li>
And here is the mousenter function:
$('a.thumb').mouseenter(function(e)
{
$(this).click();
});
What i want to achieve is to have both thing combined without having 'hovered' links Any help would be really appreciated! thank you!
Solved it, here is the answer:
<?php foreach ($products as $product) {
$enlace= $product['href'];
$rest = substr($enlace, -2);
?>
<li>
<a class="thumb" href="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>"><p class="thumb2"><?php echo $product['name']; ?></p></a>
<script type="text/javascript">
$("p.thumb2").click(function(){
window.open("index.php?route=product/product&product_id=<? echo $rest;?>", "_self")
});
</script>
</li>
<?} ?>
</ul>
<script type="text/javascript">
//Makes hover work instead of click on gallery
$('a.thumb').mouseenter(function(e)
{
$(this).click();
});</script>
What are you trying to do is not possible, you are trying to bind 2 different events, however if you are going to click the mouse will have to hover it first, you can't avoid that, I suggest reevaluating your strategy, maybe adding a different link to trigger your pop up or changing classes and triggering different events depending on which class is hovered or clicked.