首页 \ 问答 \ Onclick似乎只工作一次(Onclick Only seems to be working once)

Onclick似乎只工作一次(Onclick Only seems to be working once)

所以,我遇到了这个问题,过去几天我一直试图修复它,但没有运气。 我正在使用Jquery.dotdotdot

什么是问题?

当我点击"Read More"它会扩大内容,当我点击"Read Less"它会隐藏扩展的内容。 如果我第二次点击"Read More" ,它将不起作用。

的jsfiddle:

实时网站:

HTML:

<div class='article'>
<div class='articleheader'>Title</div>
<div id='article_$count' class='articlecontent'>
    <p>But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee
       <a href='#' class='readless'>Read Less</a>
    </p>
</div>
</div>

CSS:(无所谓,只需添加到提琴的可视性提高)

jQuery的:

/*Adds the "Read More" link and truncates the text when clicking read Less. */
$('.readless').click(function () {
$(this).parents('div').eq(0).dotdotdot({
    ellipsis: '... ',
    wrap: 'word',
    fallbackToLetter: true,
    after: '<a href="#" class="readmore">Read more &raquo;</a>',
    watch: false,
    height: 100,
    tolerance: 10,
    lastCharacter: {
        remove: [' ', ',', ';', '.', '!', '?'],
        noEllipsis: []
    }
});
});

/*Truncates all articles */
$("[id^=article]").dotdotdot({
    ellipsis: '... ',
    wrap: 'word',
    fallbackToLetter: true,
    after: '<a href="#" class="readmore">Read more &raquo;</a>',
    watch: false,
    height: 100,
    tolerance: 10,
    lastCharacter: {
    remove: [' ', ',', ';', '.', '!', '?'],
    noEllipsis: []
}
});


/*removes truncation and shows the hidden "Read Less" link in content*/
$('.readmore').click(function () {
    $(this).parents('div').eq(0).trigger("destroy");
});

So, I have this issue and I have been trying to fix it for the past few days with no luck. I'm using Jquery.dotdotdot

What is the issue?

When I click "Read More" it will expand the content, when I click "Read Less" it will hide the expanded content. If I click "Read More" for a SECOND time it will not work.

JSFiddle:

Live Website:

HTML:

<div class='article'>
<div class='articleheader'>Title</div>
<div id='article_$count' class='articlecontent'>
    <p>But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee
       <a href='#' class='readless'>Read Less</a>
    </p>
</div>
</div>

CSS: (Doesn't matter, just added to fiddle for improved visibility)

jQuery:

/*Adds the "Read More" link and truncates the text when clicking read Less. */
$('.readless').click(function () {
$(this).parents('div').eq(0).dotdotdot({
    ellipsis: '... ',
    wrap: 'word',
    fallbackToLetter: true,
    after: '<a href="#" class="readmore">Read more &raquo;</a>',
    watch: false,
    height: 100,
    tolerance: 10,
    lastCharacter: {
        remove: [' ', ',', ';', '.', '!', '?'],
        noEllipsis: []
    }
});
});

/*Truncates all articles */
$("[id^=article]").dotdotdot({
    ellipsis: '... ',
    wrap: 'word',
    fallbackToLetter: true,
    after: '<a href="#" class="readmore">Read more &raquo;</a>',
    watch: false,
    height: 100,
    tolerance: 10,
    lastCharacter: {
    remove: [' ', ',', ';', '.', '!', '?'],
    noEllipsis: []
}
});


/*removes truncation and shows the hidden "Read Less" link in content*/
$('.readmore').click(function () {
    $(this).parents('div').eq(0).trigger("destroy");
});

原文:https://stackoverflow.com/questions/23364006
更新时间:2023-02-28 14:02

最满意答案

我发现了什么是错的。 这是设置(系统/配置/系统/ Cron)。 当我将“提前计划”设置为60时,它开始正常工作(每小时和每天的时间表)。 现在数据库中的时间表在15:20出现,当我需要执行它时16:00。

设置:

  • 生成时间表每个:15
  • 提前安排:60
  • 错过,如果不在其中运行:60
  • 历史清理每一个:120
  • 成功历史一生:120
  • 失败历史终生:3000

如果您遇到同样的问题,您应该注意前两个设置:“生成每个计划”和“提前计划”


I've figured out what was wrong. It were settings (System/Configuration/System/Cron). When I set up "Schedule Ahead for" to 60 it started to work properly (every hour and every day schedules). For now schedule in database is appearing at 15:20 when I need to execute it 16:00.

Settings:

  • Generate Schedules Every: 15
  • Schedule Ahead for: 60
  • Missed if Not Run Within: 60
  • History Cleanup Every: 120
  • Success History Lifetime: 120
  • Failure History Lifetime: 3000

If you have the same problem, you should pay attention to first two settings: "Generate Schedules Every" and "Schedule Ahead for"

相关问答

更多
  • 我发现了什么是错的。 这是设置(系统/配置/系统/ Cron)。 当我将“提前计划”设置为60时,它开始正常工作(每小时和每天的时间表)。 现在数据库中的时间表在15:20出现,当我需要执行它时16:00。 设置: 生成时间表每个:15 提前安排:60 错过,如果不在其中运行:60 历史清理每一个:120 成功历史一生:120 失败历史终生:3000 如果您遇到同样的问题,您应该注意前两个设置:“生成每个计划”和“提前计划” I've figured out what was wrong. It were ...
  • cronjob运行得很好,但是cron守护进程(据我所知,守护进程一般)无法访问stdout,因此无法向终端输出消息。 但是,要测试它,您可以使用输出您想要的文件 */1 * * * * echo "job every minute" >>$HOME/filename 每分钟将文本输出(并连接)到主目录中名为“filename”的文件。 The cronjob is running just fine, but the cron daemon (daemons in general as far as I ...
  • 经过几次尝试,这对我有用。 * * * * * php /home/sturdi6/public_html/cron.php > /dev/null 然而,我遇到的基本问题(发送确认电子邮件)最终导致我需要一个SMTP插件并将其配置为使用我在cpanel中制作的网络邮件地址 SMTP Pro电子邮件 - 免费自定义SMTP电子邮件 除了安装一个调度程序以确保所有cron作业都得到管理之外,还要让它们立即发送,因为它应该一直都是lol AOE调度程序 还有一些值得注意的好东西。 Mage ...
  • 首先,关于数据库中的产品实体存储:所有内容都使用EAV模式存储,这意味着您可以向产品实体添加任意属性,并将它们视为大致等同于产品表上的另一列。 但是,它们实际上存储在一组表中,然后在您请求产品模型时必须将它们连接起来(因此您要加入几个大型表,10000次以上)。 幸运的是,有一种方法可以采用平面表的形式 - 这些表采用自定义属性并创建一个包含所有产品属性的表(使用“在产品列表中使用”选项)。 您的瓶颈可能是您没有使用此产品平台(在目录部分下的系统配置中启用它)。 它应该在打开后自动重新构建平台,如果不是,您 ...
  • Magento不知道你的“命名空间”,因此自动预装Mage。 config.xml中还有另一个错误,很可能是在global / model部分: Namespace_Campaigns_Model 应根据上面的示例代码正确定义。 Magento doesn't know your "Namespace" and automatically prepends ...
  • 当我开始时,我想立即开始这项工作,所以我认为第三个是真的。 第四个论点,不是第三个* myJob.start(); 这条线是不必要的,可能会导致一些副作用。 因为你已经通过将4th参数设置为true来开始构造函数。 但是您显示的代码看起来有效。 是什么让你觉得它不起作用? 你已将它设置为每10分钟运行一次,你是否等待时钟为XX:X0:00以查看代码? 为了测试,您可以将'0 */10 * * * *'更改为'* * * * * *'以查看代码是否正常工作而无需等待。 Iwant to start the ...
  • 您的型号名称错误。 在标签中,写下而不是 。 你的模型没有打电话。 这就是为什么这是错误的原因 Your model name is wrong. In tag, write instead of . Your model is not calling. That is why this is ...
  • 测试哪个命令: which rake 对我来说,它位于/ usr / local / bin而不是/ usr / bin 接下来尝试在redmine文件夹中使用chdir,然后在crontab中启动命令: */5 * * * * cd /var/www/redmine/ && sudo /usr/local/bin/rake redmine:plugins:email_fetcher:fetch_all_emails RAILS_ENV=production 2>&- 1>&- 希望这可以帮到你。 干 ...
  • */5 * * * * date >> /var/www/html/magento/var/log/cron.log;/bin/sh -f /var/www/html/magento/cron.sh >> /var/www/html/magento/var/log/cron.log; 我们还运行我们的crontab作为apache用户,因为apache是我们所有magento文件的所有者: sudo crontab -e -u apache */5 * * * * date >> /var/www/ht ...
  • 如果这是一个简单的cron表达式,您可以直接参考cron文档。 但有一件事我认为你将被限制在运行此任务的机器的本地机器时区。 这五颗星的解释如下: - Field Allowed values ----- -------------- minute 0-59 hour 0-23 day of month 1-31 month 1-12 (or names, see below) day of week 0-7 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)