I'm trying to access a function that would update the JQuery UI progress bar located in the parent from within the iframe page. Every time somebody clicks on a link in the iframe page I want it to update the progress bar. I've searched around for answers, and using "window.parent.FunctionName()" is the solution that is given, but for some reason it doesn't seem to work in my situation? Any ideas?
UPDATE: It seems to work in safari, firefox, but not in chrome???
The function that I want to access in the parent page is:
var percentage = 0;
$('ul li a').one('click', updateBar);
function updateBar() {
percentage += 8;
$('.ui-progressbar-value').stop().animate({ width: percentage+"%" }, 500)
$('.middle').progressbar('option','value', percentage);
if(percentage > 100) {
$('ui-progressbar-value').stop().animate({ width: "100%"}, 500);
}
}
The JQuery call that I'm calling from the iframe page is:
$('#sidenav ul li a').one('click', window.parent.updateBar);
try
$('#sidenav ul li a').one('click',function(){
window.parent.updateBar();
});
function updateBar(context) {
percentage += 8;
$('.ui-progressbar-value',context).stop().animate({ width: percentage+"%" }, 500)
$('.middle',context).progressbar('option','value', percentage);
if(percentage > 100) {
$('ui-progressbar-value',context).stop().animate({ width: "100%"}, 500);
}
}
$('#sidenav ul li a').one('click', function(){window.parent.updateBar(document);});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.