newbie27
asked on
jquery - image opacity
Hello Experts,
I am making an icon on the page to look pale by reducing its opacity when the user clicks on it.
something like this
$(this).animate({opacity: "0.3"}, 500);
It is working fine on the event, however it is not retaining its style when I refresh the page.
Can someone please let me know If we can do quick jQuery search if the Id of this icon exist in the menu where it has been added then keep the pale look. Please can someone advice how to check this?
Thanks for your help.
Regards
S
I am making an icon on the page to look pale by reducing its opacity when the user clicks on it.
something like this
$(this).animate({opacity: "0.3"}, 500);
It is working fine on the event, however it is not retaining its style when I refresh the page.
Can someone please let me know If we can do quick jQuery search if the Id of this icon exist in the menu where it has been added then keep the pale look. Please can someone advice how to check this?
Thanks for your help.
Regards
S
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks hielo
ASKER
Hielo,
I have tried to add a function to get the values from the cookie check with added list Id,
I have added a retainImageSyle function and calling it from document ready
https://www.experts-exchange.com/questions/23529734/jQuery-Image-opacity.html
please see and add your comments there
thanks
sam
I have tried to add a function to get the values from the cookie check with added list Id,
I have added a retainImageSyle function and calling it from document ready
https://www.experts-exchange.com/questions/23529734/jQuery-Image-opacity.html
please see and add your comments there
thanks
sam
function retainImageSyle(){
/*
// is this not correct ?
var myList = getShortList();
for(var x=0; x<myList.length; x++)
{
$('#'+ myList[x].id + '_li').slideDown("slow");
$('#'+ myList[x].id + '_spg').fadeOut('fast', function(){$(this).remove()});
}*/
var myId = $(this).attr('id');
var theId = myId.replace('_lnk', '');
var myTitle = $(this).attr('title') ;
// $('.addToShortList').click(function() {add2ShortList.call(this,true);});
//check if the item already added
var myLi = $('#' + theId + '_li').html();
alert(myLi);
//if (myLi){
// $('#'+myId).mousedown(function(){$('#' + theId + '_li').css('background','#fef8a5')});
// $('#'+myId).mouseup(function(){$('#' + theId + '_li').css('background','')});
// return;
}
}
ASKER
Open in new window