Hi John,
Firstly many thanks for taking the time to look into this for me and for the extended essay detailing the issues involved. Much appreciated as always.
You have raised some interesting points for me to consider. Just to make sure we are on the same page with this I have uploaded a couple of test cases. One is a css/html solution, the other a javascript attempt. Both have some issues (yes I'm a novice) and I’m not sure which way to proceed.
Just to be clear - I don’t want the hover to actually do anything until a click is made. I just want different cursor.png on each side of the page.
So - the css/html
Code:
.prev1 {
left: 0px;
width: 50%;
z-index: 22;
background: transparent;
position: absolute;
cursor: url('images/prevg.png') , auto;
}
.next1 {
right: 0px;
width: 50%;
z-index: 22;
background: transparent;
position: absolute;
cursor: url('images/nextg.png') , auto;
}
<div class="prev1">
<a class="btn btn-custom btn-large" button id="slider-prev"></a>
</div>
<div class="next1">
<a class="btn btn-custom btn-large" button id="slider-next"></a>
</div>
This version works exactly as it should on desktop devices.
The problem is that when a touch device is used the transparent navigation divs get in the way of swipe gestures.
I probably could use media queries to hide these divs and partially get around this however the lines between touch and desktop devices are getting more and more blurred so I’m not sure if this is the answer.
Modernizr could also be a possibility but I have never used it and don’t know how reliable it is. And then there are devices that have both touch and mouse control.
and - the javascript
Code:
}).data('royalSlider');
slider.ev.on('rsSlideClick', function(e, origEvent) {
var width = jQuery('.royalSlider').data('royalSlider').width;
if (origEvent.pageX < (width/2)) {
slider.prev();
$('.rsOverflow').css({
'cursor': 'url(images/prevg.png), default'
});
} else {
slider.next();
$('.rsOverflow').css({
'cursor': 'url(images/nextg.png), default'
});
};
});
});
This works perfectly on touch devices and swipes as intended.
It also almost works on desktop.
My theory was that as the cursor would be hidden on touch devices it would not come into play. ie. I don’t need the hover events at all on touch as the swipe will take over.
On desktop I don’t actually want the hover to do anything but change the source of the cursor.png as the user moves across the page. Only when the user clicks will anything happen.
I’m a little confused. Is this still as problematic as you first thought. Is there a way to achieve the look I would like through either of these methods? What would you suggest.
It seems a lot of headache for a little bit of functionality but what can I say - I have a couple of sites I was hoping to do like this and, well for now, I really like it.
Thanks again for checking this out for me.
Cheers
ps. I did ask the people who made the script. I’m not sure how clearly I asked what I wanted. Anyway they referred me to this
http://stackoverflow.com/questions/7...ack-mouse-p...
which I have to say is way out of my league for now!
Bookmarks