(function($) {
$.extend({
notify: function(options, duration) {
var defaults = {
inline: true,
href: '',
html: ''
};
var options = $.extend(defaults, options);
var body = $('body'),
container = $('<ul></ul>').attr('id', 'notification_area'),
wrapper = '<li class="notification"></li>',
clone;
if (!body.hasClass('notifications_active')) {
body.append(container).addClass('notifications_active');
}
if (options.inline == true && options.href) {
clone = $(options.href).clone().wrap(wrapper);
}
clone.css('visibility', 'hidden').appendTo(container);
var clone_height = 0 - parseInt(clone.outerHeight());
clone.css('marginBottom', clone_height);
clone.animate({
marginBottom: 0
}, 'fast', function() {
clone.hide().css('visibility', 'visible').fadeIn('fast');
});
}
});
})(jQuery);
$(function() {
$('a').click(function() {
$.notify({ …Run Code Online (Sandbox Code Playgroud) 我想将视图分为四个部分.顶部的标题,使用整页宽度和固定高度.剩下的页面被分成两个相同高度的块,它们的上面包含两个相同大小的块,彼此相邻.
我尝试的是(没有标题):
#wrap {
width: 100%;
height: 100%;
}
#block12 {
width: 100%;
max-height: 49%;
}
#block1,
#block2 {
width: 50%;
height: 100%;
float: left;
overflow-y: scroll;
}
#block3 {
width: 100%;
height: 49%;
overflow: auto;
/*background: blue;*/
}
.clear {
clear: both;
}
Run Code Online (Sandbox Code Playgroud)
而CSS:
<div id="wrap">
<div id="block12">
<div id="block1"></div>
<div id="block2"></div>
<div class="clear"></div>
</div>
<div id="block3"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
显然,使用高度的百分比值将无法正常工作.为什么会这样?
我正在尝试使用一个将由_wrap_run方法包装的run方法创建一个对象.我希望能够通过简单地键入instance.run()来调用方法和它的包装器,并且我希望能够对该对象进行子类化,以便我可以覆盖run()方法并让它仍然执行包装器.
更简单地说,我希望人们能够子类化A并覆盖run()但仍然调用run()方法执行包装函数.
我对这个机制有些困难.有没有人对这种方法有任何建议?谢谢阅读.
class A:
def run(self):
print "Run A"
return True
def _wrap_run(self):
print "PRE"
return_value = self.run()
print "POST"
return return_value
run = property(_wrap_run)
a = A()
a.run()
"""
Should Print:
PRE
Run A
POST
"""
class B(A):
def run(self):
print "Run B"
return True
b = B()
b.run()
"""
Should Print:
PRE
Run B
POST
"""
Run Code Online (Sandbox Code Playgroud) 我有很多情况下我有自动调整大小的面板或网格,但是如果它们包含一个TextBoxwith TextWrapping="Wrap",TextBox则会在它真正需要之前将面板/网格继续向右扩展,例如下面的图像:

我想要做的是TextBox通过在尝试向右扩展之前包装文本来填充其区域.该问题的简化示例是:
<Grid>
<Grid Background="Black" />
<Grid VerticalAlignment="Top" HorizontalAlignment="Left" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBox TextWrapping="Wrap" Height="120" MinWidth="200" />
</Grid>
</Grid>
Run Code Online (Sandbox Code Playgroud)
我在这里找到了类似的问题,但是发布的最佳解决方案不允许TextBox扩展.该解决方案类似于:
<Grid>
<Grid Background="Black">
</Grid>
<Grid VerticalAlignment="Top" HorizontalAlignment="Left" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border BorderThickness="0" x:Name="border" Margin="0.5" />
<TextBox TextWrapping="Wrap" Height="120" MinWidth="200" Width="{Binding ActualWidth, ElementName=border}" />
</Grid>
</Grid>
Run Code Online (Sandbox Code Playgroud)
除了TextBox使用修改过的行为进行扩展之外 谢谢!
我想定位覆盖图像的文本.以下是我目前使用的代码:
<td width="10%">
<img src="tempballoon.png" alt="balloon" style="z-index: -1" />
<div style="position:relative;left:30px;top:-75px;font-size: 32px;display: none">
Test
</div>
</td>Run Code Online (Sandbox Code Playgroud)
我的问题是,虽然文本被正确覆盖,但它所消耗的"空间" <td>仍然存在!当我试图替换<div>'margin-top'中的'top'位置时,它也会影响the <img>,因此它<img>会越过边界<td>.
请帮我!
谢谢!
我有一个类不能实现可比性,但需要根据2个字段进行排序.我怎样才能用番石榴来实现这个目标?
让我们说这堂课是:
class X {
String stringValue;
java.util.Date dateValue;
}
Run Code Online (Sandbox Code Playgroud)
我列出了这些:
List<X> lotsOfX;
Run Code Online (Sandbox Code Playgroud)
我想先根据值字段对它们进行排序,然后根据每个'组'的'value'字段中的dateValue进行排序.
到目前为止我一直在做的是:
List<X> sortedList = ImmutableList.copyOf(Ordering.natural().onResultOf(dateValueSortFunction).reverse().sortedCopy(lotsOfX));
sortedList = ImmutableList.copyOf(Ordering.natural().onResultOf(stringValueSortFunction).sortedCopy(sortedList));
Run Code Online (Sandbox Code Playgroud)
功能定义为:
public class DateValueSortFunction<X> implements Function<X, Long> {
@Override
public Long apply(X input) {
return input.getDateValue().getTime(); //returns millis time
}
}
Run Code Online (Sandbox Code Playgroud)
和:
public class StringValueSortFunction<X> implements Function<X, Integer> {
@Override
public Integer apply(X input) {
if(input.getStringValue().equalsIgnoreCase("Something"))
return 0;
else if(input.getStringValue().equalsIgnoreCase("Something else"))
return 1;
else
return 2;
}
}
Run Code Online (Sandbox Code Playgroud)
预期产量sortedList为:
Something 03/18/2013
Something 03/17/2013
Something else 03/20/2013 …Run Code Online (Sandbox Code Playgroud) 喜欢在标题...由于某种原因,magento网站不应用优惠券代码...总是返回无效的"优惠券代码无效"消息.但奇怪的是,当购物车的价格大于120我的货币时会发生这种情况.
示例:如果我在购物车中有一个价格为65的产品,则优惠券代码可以正常工作...如果我在购物车中有相同的产品但是数量为2(这意味着总价格变为130)我得到上述无效错误信息
我已经将代码追溯到"Mage_Sales_Model_Quote"类,它有一个名为:_validateCouponCode()的函数,里面有以下内容:$ address-> hasCouponCode()总是返回false ...我该怎么办?...我重新索引,刷新缓存......等等...没有改变...我似乎无法在地址模型中找到hasCouponCode函数,看看那里发生了什么...非常感谢提前
我想确定一个向量是否总是在R中增加或总是在R中减少.
理想情况下,如果我有这三个向量:
asc=c(1,2,3,4,5)
des=c(5,4,3,2,1)
non=c(1,3,5,4,2)
Run Code Online (Sandbox Code Playgroud)
我希望前两个返回TRUE,最后一个返回FALSE.
我尝试了几种方法.首先,我试过:
> is.ordered(asc)
[1] FALSE
> is.ordered(des)
[1] FALSE
> is.ordered(non)
[1] FALSE
Run Code Online (Sandbox Code Playgroud)
我也尝试过:
> order(non)
[1] 1 5 2 4 3
Run Code Online (Sandbox Code Playgroud)
并希望我可以简单地将此向量与1,2,3,4,5和比较5,4,3,2,1,但即使返回一串逻辑,而不是单个true或false:
> order(non)==c(1,2,3,4,5)
[1] TRUE FALSE FALSE TRUE FALSE
Run Code Online (Sandbox Code Playgroud) 全新安装Magento 1.9.1.
Magento忽略了Catalogue-> Attributes-> Manage Attributes-> Manage Labels/Options中为可配置产品下拉列表设置的属性位置.相反,它使用产品ID来确定列表顺序.
比较了以下文件/功能,除了小额税收计算外,自1.7.0.2以来,没有任何代码发生过变化.
法师/目录/型号/产品/类型/ Configuarable.php:
public function getConfigurableAttributes($product = null)
Run Code Online (Sandbox Code Playgroud)
法师/目录/型号/产品/ Option.php:
public function getProductOptionCollection(Mage_Catalog_Model_Product $product)
Run Code Online (Sandbox Code Playgroud)
法师/目录/座/产品/浏览/类型/ Configuarable.php:
public function getJsonConfig()
Run Code Online (Sandbox Code Playgroud)
我还在一个实时网站的副本数据库上进行了测试,所有属性排序都基于产品ID.
复制:
编辑属性并更改标签位置.蓝色0,绿色1,红色3,黑色4
查看产品时,Magento仍会按产品ID对属性进行排序,并忽略位置.
我有这个动态创建的布局:
for (let i = 1; i < 10; i++) {
document.querySelector('.card-body').innerHTML += `<div class="row" id="img_div">
<div class="col-12 col-sm-12 col-md-2 text-center">
<img src="http://placehold.it/120x80" alt="prewiew" width="120" height="80">
</div>
<div id="text_div" class="col-12 text-sm-center col-sm-12 text-md-left col-md-6">
<h4 class="name"><a href="#" id="title` + i + `">Name</a></h4>
<h4>
<small>state</small>
</h4>
<h4>
<small>city</small>
</h4>
<h4>
<small>zip</small>
</h4>
</div>
<div class="col-12 col-sm-12 text-sm-center col-md-4 text-md-right row">
</div>
</div>
`
document.getElementById("title" + i).addEventListener('click', function() {
console.log(i)
});
}Run Code Online (Sandbox Code Playgroud)
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<div class="card-body">
<!-- person --> …Run Code Online (Sandbox Code Playgroud)