I'm making a slideshow which uses both classes(Positioning) and IDs(Styling), now when I move an image, Im changing its class; but when mouseenter(class) gets triggered, jQuery is still reading the old html where .pc1 was a certain image but now its another.
Is there a way around this?
I'm trying to use this:
$(document).find('.pccenter').mouseenter(function(){
if (loading != true) {
$(this).fadeTo(1000, 1);
$(this).parent().children('.shinepc').fadeTo(2000, 0.4);
}
});
var position ="";
var shinepos = "";
$('.pccenter').mouseover(function(){
position = $(document).find('.pccenter').attr('id');
shinepos = $(document).find('.shinepc').attr('id');
console.log(shinepos);
console.log(position);
if (loading != true) {
$('#' + position).fadeTo(1000, 1);
$('#' + shinepos).fadeTo(2000, 0.4);
}
});
$('.pccenter').mouseleave(function(){
position = $(document).find('.pccenter').attr('id');
shinepos = $(document).find('.shinepc').attr('id');
if (loading != true) {
$('#' + position).fadeTo(1000, 0.6);
$('#' + shinepos).fadeTo(3000, 0.2);
}
});
Tried using that with:
<div class="pcmidr" id="pcmidr"><div class="shinepcmidr" id="shinepcmidr"></div></div>
<div class="pccenter" id="pccenter"><div class="shinepc" id="shinepc"></div></div>
Now the class "pcmidr" changes to pccenter and pccenter changes to pcmidl.
$(document).find('.pccenter').mouseleave(function(){
if (loading != true) {
$(this).fadeTo(1000, 0.6);
$(this).parent().children('.shinepc').fadeTo(3000, 0.2);
}
});