Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(".menu > ul > li").hover(
- function(){
- $(this).children("ul").slideDown();
- },
- function(){
- $(this).children("ul").slideUp();
- }
- );
- var imgs = $("#slider > img");
- var max = imgs.length - 1;
- var sno = 0;
- $("#slider").on("click",function(){
- $( imgs[sno] ).animate({
- left: "-100%",
- opacity: 1
- },1000,function(){
- $(this).css({
- left:"100%",
- opacity: 0
- });
- });
- sno++; //sno = sno + 1;
- if( sno > max ) sno = 0;
- $( imgs[sno] ).animate({
- left: "0",
- opacity: 1
- },1000);
- });
- var timer = setInterval(function(){
- $("#slider").click();
- },2000);
- var page = 1;
- function getlist(){
- $.get("list.php?page=" + page,function(data){
- console.log(data);
- $("#posts table tr:last").after(data);
- page++;
- });
- }
- getlist();
- $(".btn-more").on("click",function(){
- getlist();
- });
- $(window).scroll(function() {
- if($(window).scrollTop() + $(window).height() == $(document).height()) {
- getlist();
- }
- });
- $("#posts").on("click",".view-data",function(e){
- e.preventDefault();
- var id = $(this).attr("href");
- if( ! id ) return;
- $.getJSON("view.php?id=" + id, function(data){
- if( ! data ) return;
- $(".view-title").text(data.title);
- $(".view-writer").text(data.writer);
- $(".view-date").text(data.created_at);
- $(".view-content").text(data.content);
- $(".btn-del").attr("data-id",id);
- $("#myModal").modal("show");
- });
- });
- $("#posts").on("click",".btn-del",function(){
- var id = $(this).attr("data-id");
- var del = confirm("Are you sure?");
- if( ! del ) return;
- $.post("delete.php",{"id":id},function(result){
- if( ! result ) return;
- var count = parseInt(result,10);
- if( count ) location.reload();
- else alert("Can't Delete");
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement