$('a[href^="#"]').click(function () {
var elementClick = $(this).attr("href");
var destination = $(elementClick).offset().top;
if($.browser.safari){
$('body').animate( { scrollTop: destination }, 1100 );
}else{
$('html').animate( { scrollTop: destination }, 1100 );
}
return false;
});
// Выбираем все ссылки с хэшем
$('a[href*="#"]')
/* Убираем ненужные, либо те которые нужны для других целей, например для галерей, так что сюда можешь добавить список хешей на который плавный скролл не будет реагировать */
.not('[href="#"]')
.not('[href="#0"]')
.click(function(event) {
// Проверяем что все хеши на том домене
if (
location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
&&
location.hostname == this.hostname
) {
// Находим цель
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
// Существует ли целевой элемент?
if (target.length) {
// Блокируем поведение по умлочанию, только в случае если анимация на понадобилась
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000, function() {
// Callback after animation
// Меняем фокус (бывает полезно, обычно не мешает)
var $target = $(target);
$target.focus();
if ($target.is(":focus")) { // Получил ли целевой элемент фокус
return false;
} else {
$target.attr('tabindex','-1');
$target.focus();
};
});
}
}
});
addressParts.map(str => str.trim());
addressParts.map(Function.prototype.call, String.prototype.trim);
addressParts.map(function(str) { return String.prototype.trim.apply(str); });
<?php
$slide_iteration = 0;
while($slider -> have_posts()) : $slider->the_post(); $slide_iteration++;
?>
<div class="slide <?php if( $slide_iteration== 1 ) echo ' active' ?>">
<div class="slide-top"><?php the_title();?></div>
<div class="slide-bottom"><?php the_content();?></div>
<?php the_post_thumbnail();?>
</div>
<?php endwhile; ?>
db::query("update member set ncaptcha = 0 where id = :memberId", $memberId);
, эх..public function destroy(int $memberId){
//Что тут и зачем хз, что там происходит ты не написал
parent::destroy();
try{
//Что такое db? PDO?
//Далее почти тупо копипаст из маст рид книги для новичоков Php right way
$stmt = db::prepare('update member set ncaptcha = 0 where id = :memberId');
$stmt->bindParam(':memberId', $memberId, PDO::PARAM_INT);
if(!$stmt->execute()){
throw new Exception($stmt->errorInfo()[2]);
}
}
catch (Exceprion $e ) {
throw $e;
}
//А и мы что-нибудь возвращаем? Если да, то выше нужно указать и тип возвращаемого значения у метода
}
//Где-то в далеких недрах кодинга
try {
$tvoyPeremenayaClass->destroy($memberId);
}
catch (Exception $e)
{
echo 'Прости Юра, мы все просрали ...' . $e->getMessage();
}
{{ dump(user) }}
, это обертка php var_dump. Чтобы она заработала нужно включить режим дебага для Twig.$twig = new Twig_Environment($loader, array(
'debug' => true,
// ...
));
$twig->addExtension(new Twig_Extension_Debug());
return redirect()->route('contact')->withInput($request->all);
<?php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class ContactController extends Controller
{
public function showContactForm()
{
return view('default.contact')->withTitle('Contacts');
}
public function storeContactForm(Request $request, $id=FALSE)
{
return redirect()->route('front.showContactForm')->withInput($request->all);
}
}
Route::get('/contcats', 'ContactController@showContactForm')->name('front.showContactForm');
Route::post('/contcats', 'ContactController@storeContactForm');
<input type="text" name="username" value="{{ old('username') }}">