问题描述
|
你好,我必须对Nextgen gallery Slider Widget PHP输出之一执行jquery任务。至少我意识到,由于经历的缘故,我陷于茫茫荒野。有谁可以帮助我吗?
$output .= \"\\n<script type=\\\"text/javascript\\\">\";
$output .= \"\\n jQuery(window).load(function() {\";
// Shuffle results on random order so even if page is cached the order will be different each time
if($order == \'random\' && $shuffle == \'true\')
{
$output .= \"\\n jQuery(\'div#\" . $html_id . \"\').jj_ngg_shuffle();\";
}
$output .= \"\\n jQuery(\'div#\" . $html_id . \"\').nivoSlider(\";
if(count($javascript_args) > 0)
{
$output .= \"{\" . implode(\",\",$javascript_args) . \"}\";
}
$output .= \");\";
if($has_control_nav && $has_thumbs)
{
if($controlnavthumbs == \'nextgen_thumbs\' || $controlnavthumbs == \'nextgen_original\')
{
$output .= \"\\n JJNGGUtils.wordpressThumbs(\'\" . $html_id . \"\',\" . ($controlnavthumbs == \'nextgen_thumbs\' ? \'true\' : \'false\') . \");\";
}
if($has_center && $thumbsgap != \'\')
{
$output .= \"\\n JJNGGUtils.wordpressThumbsCenterFix(\'\" . $html_id . \"\');\";
}
$output .= \"\\n jQuery(\'div#\" . $html_id . \" div.nivo-controlNav\').css(\'visibility\',\'visible\');\";
}
$output .= \"\\n });\";
$output .= \"\\n</script>\\n\";
if($shortcode != \'1\')
{
echo $before_widget . \"\\n<ul class=\\\"ul_jj_slider\\\">\\n <li class=\\\"li_jj_slider\\\">\" . $output . \"\\n </li>\\n </ul>\\n\" . $after_widget;
}
else
{
echo $output;
}
}
id喜欢添加
<script type=\"text/javascript\">
jQuery(document).ready(function() {
// hides the slickBox as soon as the DOM is ready
jQuery(\'#slider\').css({visibility: \"hidden\"});
// toggles the slickBox on clicking the noted link
jQuery(\'a.nivo-controlNav\').click(function() {
jQuery(\'#slider\').css({visibility: \"visibile\"});
return false;
});
});
</script>
非常感谢您的任何提示和帮助
解决方法
您可以使用PHP Heredoc功能来实现所需的功能,这是有关Heredoc及其用法的简单教程
检查一下。您只需要用JS代码替换消息即可。您完成了。