On my website I use the following code to animate a hover action:
jQuery('#portfolio .project').hover( function() {
// Animate icon
jQuery(this).find('.overlay').animate({opacity:1.0, top:'75px'}, 300);
}, function() {
// Hide icon
jQuery(this).find('.overlay').animate({opacity:0, top:'155px'}, 300);
});
so that when the user hovers over a project an icon will be displayed as an overlay.
In this situation the image is 940px wide. But the website will be responsive, so is it possible to make this code variable depending on the window size of the browser? For example, when the browser width is 768px the icon will animate to 'top:100px' instead of 75px.
I've made a start with this, but have no idea how to go further.
jQuery(window).resize(function() {
var window_width = jQuery(window).width();