Onclick似乎只工作一次(Onclick Only seems to be working once)
所以,我遇到了这个问题,过去几天我一直试图修复它,但没有运气。 我正在使用Jquery.dotdotdot
什么是问题?
当我点击
"Read More"
它会扩大内容,当我点击"Read Less"
它会隐藏扩展的内容。 如果我第二次点击"Read More"
,它将不起作用。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 »</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 »</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.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 »</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 »</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
最满意答案
我发现了什么是错的。 这是设置(系统/配置/系统/ 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 ...
-
Cron工作不运行(Cron Job Doesn't Run)[2022-03-27]
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 ...
-
Magento:通过cron job导入/更新大量产品?(Magento: Importing / updating LOTS of products via cron job?)[2022-02-04]
首先,关于数据库中的产品实体存储:所有内容都使用EAV模式存储,这意味着您可以向产品实体添加任意属性,并将它们视为大致等同于产品表上的另一列。 但是,它们实际上存储在一组表中,然后在您请求产品模型时必须将它们连接起来(因此您要加入几个大型表,10000次以上)。 幸运的是,有一种方法可以采用平面表的形式 - 这些表采用自定义属性并创建一个包含所有产品属性的表(使用“在产品列表中使用”选项)。 您的瓶颈可能是您没有使用此产品平台(在目录部分下的系统配置中启用它)。 它应该在打开后自动重新构建平台,如果不是,您 ... -
Magento不知道你的“命名空间”,因此自动预装Mage。 config.xml中还有另一个错误,很可能是在global / model部分:
Namespace_Campaigns_Model -
当我开始时,我想立即开始这项工作,所以我认为第三个是真的。 第四个论点,不是第三个* 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 ... -
Redmine Cron工作问题(Redmine Cron Job Issue)[2022-06-20]
测试哪个命令: 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>&- 希望这可以帮到你。 干 ... -
cron job在magento site工作 - 但没有发现心跳(cron job is working in magento site- But No heartbeat found)[2023-08-20]
*/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 ...