php - fixed div does not update in Chrome unless at top of page or page scrolls -
i'm experiencing same problem in post here, solution not working me. chrome problem works fine in other browsers.
any ideas?
my fixed nav code:
<nav id="stick_nav" class="hide"> <div id="stick_nav_inner_wrapper"> <ul id="menu"> <li id="no_style"> <a href="<?php echo site_url('home');?>"> <img id="stick_nav_logo" class="clickable" src="<?php echo site_url();?>images/logo.png" style="width:95px"/> </a> </li> <li class="<?php echo $marker_home;?>"> <a href="<?php echo site_url('home');?>"> home </a> </li> <li class="<?php echo $marker_about;?>"> <a href="<?php echo site_url('home/about');?>"> </a> </li> <li class="<?php echo $marker_prod;?>"> <a href="<?php echo site_url('home/products');?>"> products </a> </li> <li class="<?php echo $marker_basket;?>"> <span style="position:relative" class="basket_count" onclick="location.href='basket'"> <?php if(isset($_session['basket'])){ $count = 0; foreach ($_session['basket'] $item){ $count+= $item['qty']; } echo $count; }else{ echo 0; }; ?> </span> </li> </ul>
fixed nav js:
$(document).ready(function() { var aboveheight = $('header').outerheight(); $(window).scroll(function(){ if ($(window).scrolltop() > aboveheight){ $('#main_nav').fadeout(); $('#stick_nav').fadein(); } else { $('#stick_nav').fadeout(); $('#main_nav').fadein(); } }); });
the script update count in fixed nav:
require_once '../inc_basket.php'; $id = filterdata($_post['id']); $menu= new menu(); $menu->getmenudata($id); if($menu->data != ""){ foreach($menu->data $md){ $basket = new shoppingbasket(); $basket->add($md['id'], $md['name'],$md['cat'],$md['price'], $md['class'], $md['description'],1); if($basket->success() == true){ if(isset($_session['basket'])){ $count = 0; foreach ($_session['basket'] $item){ $count+= $item['qty']; } ?> <script> var count ='<?php echo $count;?>'; $('.basket_count').html(''); $('.basket_count').html(count); </script> <?php } } ?>
any appreciated.
Comments
Post a Comment