首页
\
问答
\
为什么`j = ++ i ++ ++ i'的输出在C#和C中有所不同?(Why is the output of `j= ++i + ++i;` different in C# and C?)
为什么`j = ++ i ++ ++ i'的输出在C#和C中有所不同?(Why is the output of `j= ++i + ++i;` different in C# and C?)
int i=1,j; j= ++i + ++i; printf("%d",j);
这个程序的输出在C中是
6
当我使用相同的C#逻辑时,输出是5
。我想知道为什么同一个逻辑在两种不同语言中表现不同的原因
int i=1,j; j= ++i + ++i; printf("%d",j);
The output of this program is
6
in C.But when I use the same logic for C#, the output is5
.I want to know the reason why the same logic behaves differently in two different languages
原文:https://stackoverflow.com/questions/24735290
更新时间:2023-04-04 20:04
最满意答案
尝试添加
var footer = $(".container-footer"); pag.css('position', 'relative'); under toppage.css etc
和
if(scroll > footer.offset().top){ toppag.hide(); }else{ toppag.show();}
和
toppag.eq(i-1).parent().css({'z-index':"0"});
在你的第二个if(滚动)
它所做的是确保固定元素在堆叠顺序中被推到底部。
演示: 演示
Try adding
var footer = $(".container-footer"); pag.css('position', 'relative'); under toppage.css etc
and
if(scroll > footer.offset().top){ toppag.hide(); }else{ toppag.show();}
and
toppag.eq(i-1).parent().css({'z-index':"0"});
in your second if(scroll)
What this does is makes sure the fixed element gets pushed to the bottom in stacking order.
DEMO: Demo
相关问答
更多-
请参阅: http : //jsfiddle.net/9Nh7t/ 将float: left替换为display: inline-block 。 为防止包装,请在父元素上添加white-space: nowrap 。 为了摆脱“差距”(例如,在这里可以看到 ),最简单的解决方法是从HTML中删除空格: http : //jsfiddle.net/9Nh7t/2/ See: http://jsfiddle.net/9Nh7t/ Replace float: left, with display: inline ...
-
仅隐藏在固定透明导航栏后面滚动的元素部分(Hiding only the part of an element that scrolls behind a fixed transparent nav bar)[2023-09-09]
感谢@Gonzaldo。 我在导航栏后面创建了一个“隐藏”div元素,用适当的z-index数字模糊文本。 我花了一点时间才弄清楚订单和数字,但最终到达那里看起来很棒。 解决方案图 Thanks to @Gonzaldo. I created a 'hidden' div element behind the nav bar to obscure the text with the appropriate z-index numbers. It took a little while for me to f ... -
发生这种情况的原因是因为你的jss在设置之后会覆盖你的css。 你有两个选择: 当屏幕小于960px时,您需要编写一些javascript来更改css以display: none .cloned类的display: none 。 你可以使用!important override,它看起来像这样: .cloned { display: none !important; } 但是,我强烈建议使用选项1,因为!important覆盖通常不是最佳实践。 有关!important更多信息,请参阅此文章 。 The r ...
-
var startOn = 5; var mc = $('#main_content').offset().top; var rc = $('#related_content').offset().top; var om = $('#openmodal').offset().top; var rangeLimit = rc - om; 您在滚动函数之外声明这些,因此它们始终具有在页面加载时获得的初始值。 您需要将它们放入处理滚动事件的函数中。 I believe I've finally figure ...
-
浮动元素延伸过页脚(floating element extends past footer)[2022-08-27]
可能是这样的: * { box-sizing: border-box; margin: 0; padding: 0; } .container { width: 100%; } .row { width: 100%; overflow: auto; } aside { width: 20%; background-color: red; float: left; } section { margin-left:20%; width: 80%; ... -
如何在滚动时保持
- 元素固定在
[2022-02-24]- 元素的顶部和底部(How to keep
- elements fixed top and bottom of
- element when scrolling)
我使用一些CSS并制定指令来管理它。 在这里做了一个plu .. 我做了一个每个li元素得到的指令。 然后在指令中使用jquery,我得到必要的元素,比如div ,它有滚动,当前的li元素等。 两个布线用于检查li是固定在顶部还是底部。 然后检查当前的scrollPosition(scrollTop)是否高于或低于当前的li元素。 它也检查所以li元素也附加了活动布尔值。 return { restrict: 'A', link: function($scope, elem ... - 元素固定在
-
尝试添加 var footer = $(".container-footer"); pag.css('position', 'relative'); under toppage.css etc 和 if(scroll > footer.offset().top){ toppag.hide(); }else{ toppag.show();} 和 toppag.eq(i-1).parent().css({'z-index':"0"}); 在你的第二个if(滚动) 它所做的是确保固定元素在堆 ...
-
滚动时根据其他元素显示/隐藏(切换)固定元素?(Show/Hide (Toggle) a Fixed Element Depending on Other Elements When Scrolling?)[2023-06-15]
这是你想要的吗? 如果是的话,解决方法是你应该考虑窗口顶部到#div2(中间部分)的距离, 编辑 添加评论提到的功能 $(document).ready(function() { var $window = $(window); var div2 = $('#div2'); var div1 = $('#div1'); $window.on('scroll', function() { var scrollTop = document.documentElement.scr ... -
我设法很简单地解决了这个问题。 在滚动功能内部,我设置了2个变量,一个用于固定元素的位置,另一个用于页脚的位置。 这些返回元素顶部距页面顶部的精确值。 对于固定元素,我需要知道到这个元素底部的距离,所以我也包括高度。 var $fixedpos = $(".game_widget").offset().top + $('.game_widget').height(); var $footerpos = $("footer").offset().top - 25; // 25 accounts for mar ...
-
通过点击进入固定元素(Pass click through to fixed element)[2022-06-13]
实际上pointer-events:none预期的工作。 但是阻止你点击lower是body元素。 由于在您的lower设置z-index:-1 ,它将被发送到其父级(它是body )的后面。 所以你可以将body的z-index设置为更负的数字,当然postion应该是static以外的一些值(默认): body { z-index:-1000; position:relative; } 演示 In fact pointer-events:none works expectedly. But w ...