The content of this article is about how to implement html background navigation iframe click to change url (code). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
I wrote a small project, and I found a background template on the Internet, but I didn’t want to load the head and footer repeatedly...
I thought of using an iframe, and I’ll write whatever I want. Everyone is welcome. Advice
id="nav_menu" is added to the ul of the secondary menu...
<script type="text/javascript"> //导航 $('#nav_menu a').click(function(){ //选中样式 $(".am-fr").removeClass('am-icon-star'); $(this).children('.am-fr').addClass('am-icon-star'); //url href = $(this).attr('href'); $('#iframe').attr('src',href); return false; }); //iframe是否加载完,并且隐藏滚动条 var iframe = document.getElementById("iframe"); if (iframe.attachEvent){ iframe.attachEvent("onload", function(){ hideS(); }); } else { iframe.onload = function(){ hideS(); }; } function hideS() { document.getElementById("iframe").scrolling="no"; document.getElementById("iframe").style.overflow="hidden"; } </script>
Related recommendations:
Bootstrap, navigation bar click effect repair (repair) _html/css_WEB-ITnose
The above is the detailed content of How to implement html background navigation iframe click to change url (code). For more information, please follow other related articles on the PHP Chinese website!